Class: Dunlop::WorkflowStepsInBatchFinished::WorkflowStepProxy
- Inherits:
-
Object
- Object
- Dunlop::WorkflowStepsInBatchFinished::WorkflowStepProxy
- Defined in:
- app/services/dunlop/workflow_steps_in_batch_finished.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
Instance Method Summary collapse
- #action(options = {}, &block) ⇒ Object
-
#description(description, options = {}, &block) ⇒ Object
Actions should be given a discription.
-
#initialize ⇒ WorkflowStepProxy
constructor
A new instance of WorkflowStepProxy.
-
#scenarios(*scenarios_definition, &block) ⇒ Object
Allow setting another scope for scenarios.
Constructor Details
#initialize ⇒ WorkflowStepProxy
Returns a new instance of WorkflowStepProxy.
75 76 77 78 79 |
# File 'app/services/dunlop/workflow_steps_in_batch_finished.rb', line 75 def initialize @actions = [] @action_descriptions = [] @scenarios_definition = nil end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
74 75 76 |
# File 'app/services/dunlop/workflow_steps_in_batch_finished.rb', line 74 def actions @actions end |
Instance Method Details
#action(options = {}, &block) ⇒ Object
97 98 99 100 |
# File 'app/services/dunlop/workflow_steps_in_batch_finished.rb', line 97 def action( = {}, &block) @actions << WorkflowStepAction.new(action: block, descriptions: @action_descriptions.map(&:strip_heredoc), scenarios_definition: @scenarios_definition) @action_descriptions = [] end |
#description(description, options = {}, &block) ⇒ Object
Actions should be given a discription. This can be done by giving a
description "Hi there, my function is to describe what the following action will do"
followed by an
action { do_something }
statement. The action can also be added directly on the description by supplying the action Proc:
description "This description will be the action at the same time", scenarios: [:scenario1] do
do_something
end
90 91 92 93 94 95 |
# File 'app/services/dunlop/workflow_steps_in_batch_finished.rb', line 90 def description(description, = {}, &block) @action_descriptions << description if block.present? # Action direct specified on description action(, &block) end end |
#scenarios(*scenarios_definition, &block) ⇒ Object
Allow setting another scope for scenarios
103 104 105 106 107 108 |
# File 'app/services/dunlop/workflow_steps_in_batch_finished.rb', line 103 def scenarios(*scenarios_definition, &block) @previous_scenarios_definition = @scenarios_definition @scenarios_definition = scenarios_definition instance_eval(&block) @scenarios_definition = @previous_scenarios_definition end |