Class: ATP::Processors::FlowID

Inherits:
ATP::Processor show all
Defined in:
lib/atp/processors/flow_id.rb

Overview

Adds the flow ID to all ids and label names

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ATP::Processor

#handler_missing, #n, #n0, #n1, #process

Instance Attribute Details

#idObject (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
# File 'lib/atp/processors/flow_id.rb', line 12

def on_id(node)
  node.updated(nil, ["#{node.value}_#{id}"])
end

#on_test_result(node) ⇒ Object Also known as: on_test_executed



16
17
18
19
20
21
22
23
24
# File 'lib/atp/processors/flow_id.rb', line 16

def on_test_result(node)
  tid, state, nodes = *node
  if tid.is_a?(Array)
    tid = tid.map { |tid| "#{tid}_#{id}" }
  else
    tid = "#{tid}_#{id}"
  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