Class: Toft::NodeController
- Inherits:
-
Object
- Object
- Toft::NodeController
- Defined in:
- lib/toft/node_controller.rb
Constant Summary collapse
- @@instance =
NodeController.new
Instance Attribute Summary collapse
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Class Method Summary collapse
Instance Method Summary collapse
- #create_node(hostname, options) ⇒ Object
- #destroy_node(hostname) ⇒ Object
-
#initialize ⇒ NodeController
constructor
A new instance of NodeController.
- #update(hostname) ⇒ Object
Constructor Details
#initialize ⇒ NodeController
Returns a new instance of NodeController.
7 8 9 |
# File 'lib/toft/node_controller.rb', line 7 def initialize @nodes = {} end |
Instance Attribute Details
#nodes ⇒ Object (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
.instance ⇒ Object
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, ) node = Node.new(hostname, ) 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 |