Class: Katte::Driver::Core
- Inherits:
-
Object
- Object
- Katte::Driver::Core
- Defined in:
- lib/katte/driver.rb
Instance Attribute Summary collapse
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
Instance Method Summary collapse
-
#initialize(nodes, options = {}) ⇒ Core
constructor
A new instance of Core.
- #run ⇒ Object
Constructor Details
#initialize(nodes, options = {}) ⇒ Core
Returns a new instance of Core.
11 12 13 14 15 16 17 18 19 |
# File 'lib/katte/driver.rb', line 11 def initialize(nodes, = {}) @nodes = nodes @nodes_list = Hash[nodes.map {|node| [node.name, node.parents.length] }] @nodes_index = Hash[nodes.map {|node| [node.name, node] }] @queue = Queue.new @summary = {:success => [], :fail => [], :skip => []} end |
Instance Attribute Details
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
10 11 12 |
# File 'lib/katte/driver.rb', line 10 def summary @summary end |
Instance Method Details
#run ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/katte/driver.rb', line 27 def run return if @nodes_list.empty? run_nodes(@nodes.select{|n| n.parents.length.zero? }) loop { method, *args = @queue.pop break if method == :_finish self.send(method, *args) } end |