class Specinfra::HostInventory
Constants
- KEYS
Attributes
backend[R]
Public Class Methods
instance()
click to toggle source
# File lib/specinfra/host_inventory.rb, line 27 def self.instance property[:host_inventory] ||= {} self.new(Specinfra.backend, property[:host_inventory]) end
new(backend, inventory = {})
click to toggle source
# File lib/specinfra/host_inventory.rb, line 32 def initialize(backend, inventory = {}) @backend = backend @inventory = inventory end
Public Instance Methods
[](key)
click to toggle source
# File lib/specinfra/host_inventory.rb, line 37 def [](key) @inventory[key.to_sym] ||= {} if @inventory[key.to_sym].empty? begin inventory_class = Specinfra::HostInventory.const_get(key.to_s.to_camel_case) @inventory[key.to_sym] = inventory_class.new(self).get rescue @inventory[key.to_sym] = nil end end @inventory[key.to_sym] end
each() { |k, self| ... }
click to toggle source
# File lib/specinfra/host_inventory.rb, line 50 def each KEYS.each do |k| yield k, self[k] end end
each_key() { |k| ... }
click to toggle source
# File lib/specinfra/host_inventory.rb, line 56 def each_key KEYS.each do |k| yield k end end
each_value() { |self| ... }
click to toggle source
# File lib/specinfra/host_inventory.rb, line 62 def each_value KEYS.each do |k| yield self[k] end end