Class: OnNode
Instance Attribute Summary collapse
-
#instance ⇒ Object
Returns the value of attribute instance.
Attributes inherited from Node
#after_list, #before_list, #code_block, #commands, #exec_block, #id, #is_concurrently, #is_safely, #name, #node_list, #parent
Instance Method Summary collapse
- #draw_block(graph) ⇒ Object
-
#initialize(parent, instance, block) ⇒ OnNode
constructor
A new instance of OnNode.
- #run(instance) ⇒ Object
Methods inherited from Node
#after_exec, #before_exec, #draw_after_blocks, #draw_before_blocks, #draw_child_nodes, #init_time, #paint, #print_tree
Constructor Details
#initialize(parent, instance, block) ⇒ OnNode
Returns a new instance of OnNode.
5 6 7 8 9 |
# File 'lib/tree_building/on_node.rb', line 5 def initialize (parent, instance, block) super(parent, block) self.instance = instance self.name = "[OnInstance]\n" + instance end |
Instance Attribute Details
#instance ⇒ Object
Returns the value of attribute instance.
4 5 6 |
# File 'lib/tree_building/on_node.rb', line 4 def instance @instance end |
Instance Method Details
#draw_block(graph) ⇒ Object
23 24 25 26 |
# File 'lib/tree_building/on_node.rb', line 23 def draw_block(graph) graph.tripleoctagon << graph.node(id) graph.node(id).label(name) end |
#run(instance) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tree_building/on_node.rb', line 11 def run(instance) init_time before_exec(@instance, @total_time) node_list.each do |node| puts @instance @total_time[:exec].push(node.run(@instance)) end after_exec(@instance, @total_time) @total_time end |