Class: Leibniz::Infrastructure

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

Instance Method Summary collapse

Constructor Details

#initialize(instances) ⇒ Infrastructure

Returns a new instance of Infrastructure.



31
32
33
34
35
36
# File 'lib/leibniz.rb', line 31

def initialize(instances)
  @nodes = Hash.new
  instances.each do |instance|
    @nodes[instance.name.sub(/^leibniz-/, '')] = Node.new(instance)
  end
end

Instance Method Details

#[](name) ⇒ Object



38
39
40
# File 'lib/leibniz.rb', line 38

def [](name)
  @nodes[name]
end

#convergeObject



42
43
44
# File 'lib/leibniz.rb', line 42

def converge
  @nodes.each_pair { |name, node| node.converge }
end

#destroyObject



46
47
48
# File 'lib/leibniz.rb', line 46

def destroy
  @nodes.each_pair { |name, node| node.destroy }
end