Class: ATP::Processors::Relationship::ExtractTestResults
- Inherits:
-
ATP::Processor
- Object
- ATP::Processor
- ATP::Processors::Relationship::ExtractTestResults
- Defined in:
- lib/atp/processors/relationship.rb
Overview
Extracts all test-result nodes from the given AST
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #on_if_failed(node) ⇒ Object (also: #on_if_any_failed, #on_if_all_failed)
- #on_if_passed(node) ⇒ Object (also: #on_if_any_passed, #on_if_all_passed)
- #on_if_ran(node) ⇒ Object (also: #on_unless_ran)
Methods inherited from ATP::Processor
#clean_flag, #extract_volatiles, #handler_missing, #process, #process_all, #run, #volatile?, #volatile_flags
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
12 13 14 |
# File 'lib/atp/processors/relationship.rb', line 12 def results @results end |
Instance Method Details
#on_if_failed(node) ⇒ Object Also known as: on_if_any_failed, on_if_all_failed
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/atp/processors/relationship.rb', line 14 def on_if_failed(node) ids, *children = *node unless ids.is_a?(Array) ids = [ids] end ids.each do |id| results[id] ||= {} results[id][:failed] = true end process_all(children) end |
#on_if_passed(node) ⇒ Object Also known as: on_if_any_passed, on_if_all_passed
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/atp/processors/relationship.rb', line 28 def on_if_passed(node) ids, *children = *node unless ids.is_a?(Array) ids = [ids] end ids.each do |id| results[id] ||= {} results[id][:passed] = true end process_all(children) end |
#on_if_ran(node) ⇒ Object Also known as: on_unless_ran
42 43 44 45 46 47 |
# File 'lib/atp/processors/relationship.rb', line 42 def on_if_ran(node) id, *children = *node results[id] ||= {} results[id][:ran] = true process_all(children) end |