Class: Toft::NodeController

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

Constant Summary collapse

@@instance =
NodeController.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNodeController

Returns a new instance of NodeController.



7
8
9
# File 'lib/toft/node_controller.rb', line 7

def initialize
  @nodes = {}
end

Instance Attribute Details

#nodesObject (readonly)

Returns the value of attribute nodes.



5
6
7
# File 'lib/toft/node_controller.rb', line 5

def nodes
  @nodes
end

Class Method Details

.instanceObject



27
28
29
# File 'lib/toft/node_controller.rb', line 27

def instance
  @@instance
end

Instance Method Details

#create_node(hostname, options) ⇒ Object



11
12
13
14
15
# File 'lib/toft/node_controller.rb', line 11

def create_node(hostname, options)
  node = Node.new(hostname, options)
  node.add_observer self
  @nodes[hostname] = node
end

#destroy_node(hostname) ⇒ Object



21
22
23
# File 'lib/toft/node_controller.rb', line 21

def destroy_node(hostname)
  @nodes[hostname].destroy
end

#update(hostname) ⇒ Object



17
18
19
# File 'lib/toft/node_controller.rb', line 17

def update(hostname)
  @nodes.delete hostname
end