Class: SpotFlow::Bpmn::Step
- Defined in:
- lib/spot_flow/bpmn/step.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
-
#default_ref ⇒ Object
Returns the value of attribute default_ref.
-
#incoming ⇒ Object
Returns the value of attribute incoming.
-
#outgoing ⇒ Object
Returns the value of attribute outgoing.
Attributes inherited from Element
#extension_elements, #id, #name
Instance Method Summary collapse
- #converging? ⇒ Boolean
- #diverging? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Step
constructor
A new instance of Step.
- #input_mappings ⇒ Object
- #leave(execution) ⇒ Object
- #outgoing_flows(execution) ⇒ Object
- #output_mappings ⇒ Object
Methods inherited from Element
Constructor Details
#initialize(attributes = {}) ⇒ Step
Returns a new instance of Step.
8 9 10 11 12 13 14 |
# File 'lib/spot_flow/bpmn/step.rb', line 8 def initialize(attributes = {}) super(attributes.except(:incoming, :outgoing, :default)) @incoming = Array.wrap(attributes[:incoming]) || [] @outgoing = Array.wrap(attributes[:outgoing]) || [] @default_ref = attributes[:default] end |
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
6 7 8 |
# File 'lib/spot_flow/bpmn/step.rb', line 6 def default @default end |
#default_ref ⇒ Object
Returns the value of attribute default_ref.
6 7 8 |
# File 'lib/spot_flow/bpmn/step.rb', line 6 def default_ref @default_ref end |
#incoming ⇒ Object
Returns the value of attribute incoming.
6 7 8 |
# File 'lib/spot_flow/bpmn/step.rb', line 6 def incoming @incoming end |
#outgoing ⇒ Object
Returns the value of attribute outgoing.
6 7 8 |
# File 'lib/spot_flow/bpmn/step.rb', line 6 def outgoing @outgoing end |
Instance Method Details
#converging? ⇒ Boolean
20 21 22 |
# File 'lib/spot_flow/bpmn/step.rb', line 20 def converging? incoming.length > 1 end |
#diverging? ⇒ Boolean
16 17 18 |
# File 'lib/spot_flow/bpmn/step.rb', line 16 def diverging? outgoing.length > 1 end |
#input_mappings ⇒ Object
39 40 41 |
# File 'lib/spot_flow/bpmn/step.rb', line 39 def input_mappings extension_elements&.io_mapping&.inputs || [] end |
#leave(execution) ⇒ Object
24 25 26 27 |
# File 'lib/spot_flow/bpmn/step.rb', line 24 def leave(execution) execution.end(false) execution.take_all(outgoing_flows(execution)) end |
#outgoing_flows(execution) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/spot_flow/bpmn/step.rb', line 29 def outgoing_flows(execution) flows = [] outgoing.each do |flow| result = flow.evaluate(execution) unless default&.id == flow.id flows.push flow if result end flows = [default] if flows.empty? && default return flows end |
#output_mappings ⇒ Object
43 44 45 |
# File 'lib/spot_flow/bpmn/step.rb', line 43 def output_mappings extension_elements&.io_mapping&.outputs || [] end |