Class: BPMN::Step
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.
7 8 9 10 11 12 13 |
# File 'lib/bpmn/step.rb', line 7 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.
5 6 7 |
# File 'lib/bpmn/step.rb', line 5 def default @default end |
#default_ref ⇒ Object
Returns the value of attribute default_ref.
5 6 7 |
# File 'lib/bpmn/step.rb', line 5 def default_ref @default_ref end |
#incoming ⇒ Object
Returns the value of attribute incoming.
5 6 7 |
# File 'lib/bpmn/step.rb', line 5 def incoming @incoming end |
#outgoing ⇒ Object
Returns the value of attribute outgoing.
5 6 7 |
# File 'lib/bpmn/step.rb', line 5 def outgoing @outgoing end |
Instance Method Details
#converging? ⇒ Boolean
19 20 21 |
# File 'lib/bpmn/step.rb', line 19 def converging? incoming.length > 1 end |
#diverging? ⇒ Boolean
15 16 17 |
# File 'lib/bpmn/step.rb', line 15 def diverging? outgoing.length > 1 end |
#input_mappings ⇒ Object
38 39 40 |
# File 'lib/bpmn/step.rb', line 38 def input_mappings extension_elements&.io_mapping&.inputs || [] end |
#leave(execution) ⇒ Object
23 24 25 26 |
# File 'lib/bpmn/step.rb', line 23 def leave(execution) execution.end(false) execution.take_all(outgoing_flows(execution)) end |
#outgoing_flows(execution) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/bpmn/step.rb', line 28 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
42 43 44 |
# File 'lib/bpmn/step.rb', line 42 def output_mappings extension_elements&.io_mapping&.outputs || [] end |