Class: CallSheet::Step Private
- Inherits:
-
Object
- Object
- CallSheet::Step
- Includes:
- Deterministic::Prelude::Result, Wisper::Publisher
- Defined in:
- lib/call_sheet/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
- #step_name ⇒ Object readonly private
Instance Method Summary collapse
- #arity ⇒ Object private
- #call(input) ⇒ Object private
-
#initialize(step_name, operation, call_args = []) ⇒ Step
constructor
private
A new instance of Step.
- #with_call_args(*call_args) ⇒ Object private
Constructor Details
#initialize(step_name, operation, 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.
14 15 16 17 18 |
# File 'lib/call_sheet/step.rb', line 14 def initialize(step_name, operation, call_args = []) @step_name = step_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.
12 13 14 |
# File 'lib/call_sheet/step.rb', line 12 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.
11 12 13 |
# File 'lib/call_sheet/step.rb', line 11 def operation @operation 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.
10 11 12 |
# File 'lib/call_sheet/step.rb', line 10 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.
37 38 39 |
# File 'lib/call_sheet/step.rb', line 37 def arity operation.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.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/call_sheet/step.rb', line 24 def call(input) args = (call_args << input) result = operation.call(*args) result.map { |value| broadcast :"#{step_name}_success", value Success(value) }.map_err { |value| broadcast :"#{step_name}_failure", *args, value Failure(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.
20 21 22 |
# File 'lib/call_sheet/step.rb', line 20 def with_call_args(*call_args) self.class.new(step_name, operation, call_args) end |