Class: Katte::Driver::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/katte/driver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  @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

#summaryObject (readonly)

Returns the value of attribute summary.



10
11
12
# File 'lib/katte/driver.rb', line 10

def summary
  @summary
end

Instance Method Details

#runObject



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