Class: Specinfra::HostInventory
- Inherits:
-
Object
- Object
- Specinfra::HostInventory
- Includes:
- Singleton
- Defined in:
- lib/specinfra/host_inventory.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize ⇒ HostInventory
constructor
A new instance of HostInventory.
Constructor Details
#initialize ⇒ HostInventory
Returns a new instance of HostInventory.
5 6 7 8 |
# File 'lib/specinfra/host_inventory.rb', line 5 def initialize property[:host_inventory] ||= {} @inventory = property[:host_inventory] end |
Instance Method Details
#[](key) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/specinfra/host_inventory.rb', line 10 def [](key) @inventory[key.to_sym] ||= {} if @inventory[key.to_sym].empty? @inventory[key.to_sym] = Specinfra::Runner.send("get_inventory_#{key}") end @inventory[key.to_sym] end |