Class: ATP::Processors::ConditionExtractor
Instance Attribute Summary collapse
Instance Method Summary
collapse
#handler_missing, #n, #n0, #n1, #process
Instance Attribute Details
#conditions ⇒ Object
Returns the value of attribute conditions.
4
5
6
|
# File 'lib/atp/processors/condition_extractor.rb', line 4
def conditions
@conditions
end
|
#results ⇒ Object
Returns the value of attribute results.
4
5
6
|
# File 'lib/atp/processors/condition_extractor.rb', line 4
def results
@results
end
|
Instance Method Details
#on_boolean_condition(node) ⇒ Object
Also known as:
on_flow_flag, on_test_result, on_test_executed, on_job, on_run_flag
13
14
15
16
17
18
19
20
|
# File 'lib/atp/processors/condition_extractor.rb', line 13
def on_boolean_condition(node)
children = node.children.dup
name = children.shift
state = children.shift
conditions << node.updated(nil, [name, state])
process_all(children)
conditions.pop
end
|
#on_group(node) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/atp/processors/condition_extractor.rb', line 27
def on_group(node)
sig = node.children.select { |n| [:id, :name, :on_fail, :on_pass].include?(n.try(:type)) }
children = node.children.dup
conditions << node.updated(nil, sig)
process_all(children - sig)
conditions.pop
end
|
#on_test(node) ⇒ Object
Also known as:
on_log, on_enable_flow_flag, on_disable_flow_flag, on_cz, on_set_result, on_render
35
36
37
|
# File 'lib/atp/processors/condition_extractor.rb', line 35
def on_test(node)
results << [conditions.uniq, node]
end
|
#run(nodes) ⇒ Object
6
7
8
9
10
11
|
# File 'lib/atp/processors/condition_extractor.rb', line 6
def run(nodes)
@results = []
@conditions = []
process_all(nodes)
@results
end
|