Class: Dry::Transaction::DSL Private
- Inherits:
-
Object
- Object
- Dry::Transaction::DSL
- Defined in:
- lib/dry/transaction/dsl.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #container ⇒ Object readonly private
- #step_adapters ⇒ Object readonly private
- #steps ⇒ Object readonly private
Instance Method Summary collapse
- #call ⇒ Object private
-
#initialize(options, &block) ⇒ DSL
constructor
private
A new instance of DSL.
- #method_missing(method_name, *args) ⇒ Object private
- #respond_to_missing?(method_name) ⇒ Boolean private
Constructor Details
#initialize(options, &block) ⇒ DSL
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of DSL.
13 14 15 16 17 18 19 |
# File 'lib/dry/transaction/dsl.rb', line 13 def initialize(, &block) @container = .fetch(:container) @step_adapters = .fetch(:step_adapters, StepAdapters) @steps = [] instance_eval(&block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dry/transaction/dsl.rb', line 25 def method_missing(method_name, *args) return super unless step_adapters.key?(method_name) step_adapter = step_adapters[method_name] step_name = args.first = args.last.is_a?(Hash) ? args.last : {} operation_name = .delete(:with) || step_name operation = container[operation_name] steps << Step.new(step_adapter, step_name, operation_name, operation, ) end |
Instance Attribute Details
#container ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/dry/transaction/dsl.rb', line 9 def container @container end |
#step_adapters ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/dry/transaction/dsl.rb', line 10 def step_adapters @step_adapters end |
#steps ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/dry/transaction/dsl.rb', line 11 def steps @steps end |
Instance Method Details
#call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 |
# File 'lib/dry/transaction/dsl.rb', line 37 def call Sequence.new(steps) end |
#respond_to_missing?(method_name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/dry/transaction/dsl.rb', line 21 def respond_to_missing?(method_name) step_adapters.key?(method_name) end |