Sha256: 08e7c0de804c92a586f7c49faca3a7aebf5ad83ef9d7b61e543b07f1ce3e0007

Contents?: true

Size: 810 Bytes

Versions: 9

Compression:

Stored size: 810 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'
require 'specinfra/host_inventory/platform'
require 'specinfra/host_inventory/platform_version'
require 'specinfra/host_inventory/filesystem'

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

9 entries across 9 versions & 1 rubygems

Version Path
specinfra-2.14.0 lib/specinfra/host_inventory.rb
specinfra-2.13.1 lib/specinfra/host_inventory.rb
specinfra-2.13.0 lib/specinfra/host_inventory.rb
specinfra-2.12.7 lib/specinfra/host_inventory.rb
specinfra-2.12.6 lib/specinfra/host_inventory.rb
specinfra-2.12.5 lib/specinfra/host_inventory.rb
specinfra-2.12.4 lib/specinfra/host_inventory.rb
specinfra-2.12.3 lib/specinfra/host_inventory.rb
specinfra-2.12.1 lib/specinfra/host_inventory.rb