Class: Bcome::Node::Resources::Inventory
- Inherits:
-
Base
- Object
- Base
- Bcome::Node::Resources::Inventory
show all
- Defined in:
- lib/objects/node/resources/inventory.rb
Instance Attribute Summary
Attributes inherited from Base
#nodes
Instance Method Summary
collapse
Methods inherited from Base
#active, #clear!, #disable, #disable!, #do_disable, #do_enable, #each, #empty?, #enable, #enable!, #first, #for_identifier, #has_active_nodes?, #initialize, #is_active_resource?, #size
Instance Method Details
#<<(node) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/objects/node/resources/inventory.rb', line 3
def <<(node)
if existing_node = for_identifier(node.identifier)
if existing_node.static_server? && node.dynamic_server?
@nodes.delete(existing_node)
else
exception_message = "#{node.identifier} is not unique within namespace #{node.parent.namespace}"
raise Bcome::Exception::NodeIdentifiersMustBeUnique, exception_message
end
end
@nodes << node
end
|
#dynamic_nodes ⇒ Object
17
18
19
|
# File 'lib/objects/node/resources/inventory.rb', line 17
def dynamic_nodes
active.select(&:dynamic_server?)
end
|
#unset! ⇒ Object
21
22
23
|
# File 'lib/objects/node/resources/inventory.rb', line 21
def unset!
@nodes = []
end
|