Method: Chef::Mixin.const_missing

Defined in:
lib/chef/mixin/deprecation.rb

.const_missing(name) ⇒ Object

Const missing hook to look up deprecated constants defined with deprecate_constant. Emits a warning to the logger and returns the replacement constant. Will call super, most likely causing an exception for the missing constant, if name is not found in the deprecated_constants collection.



44
45
46
47
48
49
50
51
52
# File 'lib/chef/mixin/deprecation.rb', line 44

def self.const_missing(name)
  if new_const = deprecated_constants[name]
    Chef::Log.warn(new_const[:message])
    Chef::Log.warn("Called from: \n#{caller[0...3].map { |l| "\t#{l}" }.join("\n")}")
    new_const[:replacement]
  else
    super
  end
end