Class: Dry::Transaction::Step Private
- Inherits:
-
Object
- Object
- Dry::Transaction::Step
- Includes:
- Wisper::Publisher
- Defined in:
- lib/dry/transaction/step.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
- #call_args ⇒ Object readonly private
- #operation ⇒ Object readonly private
- #operation_name ⇒ Object readonly private
- #options ⇒ Object readonly private
- #step_adapter ⇒ Object readonly private
- #step_name ⇒ Object readonly private
Instance Method Summary collapse
- #arity ⇒ Object private
- #call(input) ⇒ Object private
-
#initialize(step_adapter, step_name, operation_name, operation, options, call_args = []) ⇒ Step
constructor
private
A new instance of Step.
- #with_call_args(*call_args) ⇒ Object private
Constructor Details
#initialize(step_adapter, step_name, operation_name, operation, options, call_args = []) ⇒ Step
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 Step.
17 18 19 20 21 22 23 24 |
# File 'lib/dry/transaction/step.rb', line 17 def initialize(step_adapter, step_name, operation_name, operation, , call_args = []) @step_adapter = step_adapter @step_name = step_name @operation_name = operation_name @operation = operation = @call_args = call_args end |
Instance Attribute Details
#call_args ⇒ 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.
15 16 17 |
# File 'lib/dry/transaction/step.rb', line 15 def call_args @call_args end |
#operation ⇒ 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.
13 14 15 |
# File 'lib/dry/transaction/step.rb', line 13 def operation @operation end |
#operation_name ⇒ 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.
12 13 14 |
# File 'lib/dry/transaction/step.rb', line 12 def operation_name @operation_name end |
#options ⇒ 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.
14 15 16 |
# File 'lib/dry/transaction/step.rb', line 14 def end |
#step_adapter ⇒ 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/step.rb', line 10 def step_adapter @step_adapter end |
#step_name ⇒ 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/step.rb', line 11 def step_name @step_name end |
Instance Method Details
#arity ⇒ 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.
43 44 45 |
# File 'lib/dry/transaction/step.rb', line 43 def arity operation.is_a?(Proc) ? operation.arity : operation.method(:call).arity end |
#call(input) ⇒ 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.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dry/transaction/step.rb', line 30 def call(input) args = call_args + [input] result = step_adapter.call(self, *args) result.fmap { |value| broadcast :"#{step_name}_success", value value }.or { |value| broadcast :"#{step_name}_failure", *args, value Left(StepFailure.new(step_name, value)) } end |
#with_call_args(*call_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.
26 27 28 |
# File 'lib/dry/transaction/step.rb', line 26 def with_call_args(*call_args) self.class.new(step_adapter, step_name, operation_name, operation, , call_args) end |