Class: ATP::Processors::FlowID
- Inherits:
-
ATP::Processor
- Object
- ATP::Processor
- ATP::Processors::FlowID
- Defined in:
- lib/atp/processors/flow_id.rb
Overview
Adds the flow ID to all ids and label names
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #on_id(node) ⇒ Object
- #on_test_result(node) ⇒ Object (also: #on_test_executed)
- #run(node, id) ⇒ Object
Methods inherited from ATP::Processor
#handler_missing, #n, #n0, #n1, #process
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/atp/processors/flow_id.rb', line 5 def id @id end |
Instance Method Details
#on_id(node) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/atp/processors/flow_id.rb', line 12 def on_id(node) if node.value =~ /^extern/ node else node.updated(nil, ["#{node.value}_#{id}"]) end end |
#on_test_result(node) ⇒ Object Also known as: on_test_executed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/atp/processors/flow_id.rb', line 20 def on_test_result(node) tid, state, nodes = *node if tid.is_a?(Array) tid = tid.map do |tid| if tid =~ /^extern/ tid else "#{tid}_#{id}" end end else if tid !~ /^extern/ tid = "#{tid}_#{id}" end end node.updated(nil, [tid, state] + [process(nodes)]) end |
#run(node, id) ⇒ Object
7 8 9 10 |
# File 'lib/atp/processors/flow_id.rb', line 7 def run(node, id) @id = id process(node) end |