Module: Dry::Transaction::Extra

Defined in:
lib/dry/transaction/extra.rb,
lib/dry/transaction/extra/version.rb,
lib/dry/transaction/extra/steps/tap.rb,
lib/dry/transaction/extra/steps/use.rb,
lib/dry/transaction/extra/steps/async.rb,
lib/dry/transaction/extra/steps/maybe.rb,
lib/dry/transaction/extra/steps/merge.rb,
lib/dry/transaction/extra/steps/valid.rb,
lib/dry/transaction/extra/perform_later.rb,
lib/dry/transaction/extra/class_callable.rb,
lib/dry/transaction/extra/validation_dsl.rb,
lib/dry/transaction/extra/active_record_rescues.rb

Defined Under Namespace

Modules: ActiveRecordRescues, ClassCallable, PerformLater, Steps, ValidationDSL

Constant Summary collapse

VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/dry/transaction/extra.rb', line 25

def self.included(klass)
  klass.extend Extra::Steps::Async::DSL
  klass.extend Extra::Steps::Maybe::DSL
  klass.extend Extra::Steps::Use::DSL
  klass.extend Extra::Steps::Valid::DSL

  klass.extend Dry::Core::Extensions

  if defined?(ActiveRecord)
    klass.register_extension :active_record_rescues do
      require_relative "extra/active_record_rescues"
      Dry::Transaction::Step.prepend(ActiveRecordRescues)
    end
  end

  if defined?(ActiveJob)
    klass.register_extension :perform_later do
      klass.extend PerformLater
    end
  end

  klass.register_extension :validation do
    klass.extend ValidationDSL
  end

  klass.register_extension :class_callable do
    klass.extend ClassCallable
  end
end