Class: Specinfra::HostInventory

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/specinfra/host_inventory.rb

Instance Method Summary collapse

Constructor Details

#initializeHostInventory

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