Sha256: 1594d62de0c71986bd535341ce608a8303f264cf997b45fc92ff5b07b7a0e905

Contents?: true

Size: 668 Bytes

Versions: 5

Compression:

Stored size: 668 Bytes

Contents

require 'specinfra/host_inventory/memory'
require 'specinfra/host_inventory/ec2'
require 'specinfra/host_inventory/hostname'
require 'specinfra/host_inventory/domain'
require 'specinfra/host_inventory/fqdn'

module Specinfra
  class HostInventory
    include Singleton

    def initialize
      property[:host_inventory] ||= {}
      @inventory = property[:host_inventory]
    end

    def [](key)
      @inventory[key.to_sym] ||= {}
      if @inventory[key.to_sym].empty?
        inventory_class = Specinfra::HostInventory.const_get(key.to_s.to_camel_case)
        @inventory[key.to_sym] = inventory_class.get
      end
      @inventory[key.to_sym]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
specinfra-2.12.0 lib/specinfra/host_inventory.rb
specinfra-2.11.10 lib/specinfra/host_inventory.rb
specinfra-2.11.9 lib/specinfra/host_inventory.rb
specinfra-2.11.8 lib/specinfra/host_inventory.rb
specinfra-2.11.7 lib/specinfra/host_inventory.rb