Sha256: c61c1a74f23116de9379d716cf1144132c68c8b32e0375a8c805e92fac2d86ff
Contents?: true
Size: 1.06 KB
Versions: 19
Compression:
Stored size: 1.06 KB
Contents
module Specinfra class HostInventory include Singleton include Enumerable def initialize property[:host_inventory] ||= {} @inventory = property[:host_inventory] end 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.get rescue @inventory[key.to_sym] = nil end end @inventory[key.to_sym] end def each keys.each do |k| yield k, self[k] end end def each_key keys.each do |k| yield k end end def each_value keys.each do |k| yield self[k] end end def keys %w{ memory ec2 hostname domain fqdn platform platform_version filesystem cpu } end end end Specinfra::HostInventory.instance.keys.each do |k| require "specinfra/host_inventory/#{k}" end
Version data entries
19 entries across 19 versions & 1 rubygems