Class: Chef::Mixin::Language::PlatformFamilyDependentValue

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/mixin/language.rb

Overview

Implementation class for determining platform family dependent values

Instance Method Summary collapse

Constructor Details

#initialize(platform_family_hash) ⇒ PlatformFamilyDependentValue

  • { :key => “value” }


152
153
154
155
156
# File 'lib/chef/mixin/language.rb', line 152

def initialize(platform_family_hash)
  @values = {}
	  @values["default"] = nil
  platform_family_hash.each { |platform_families, value| set(platform_families, value)}
end

Instance Method Details

#value_for_node(node) ⇒ Object


158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/chef/mixin/language.rb', line 158

def value_for_node(node)
	  if node.key?(:platform_family)
    platform_family = node[:platform_family].to_s
    if @values.key?(platform_family)
      @values[platform_family]
	    else
      @values["default"]
    end
	  else
    @values["default"]
	  end
end