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.
# File lib/chef/mixin/deprecation.rb, line 45 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
Add a deprecated constant to the Chef::Mixin namespace.
name: the constant name, as a relative symbol.
replacement: the constant to return instead.
message: A message telling the user what to do instead.
deprecate_constant(:RecipeDefinitionDSLCore, Chef::DSL::Recipe, <<-EOM) Chef::Mixin::RecipeDefinitionDSLCore is deprecated, use Chef::DSL::Recipe instead. EOM
# File lib/chef/mixin/deprecation.rb, line 36 def self.deprecate_constant(name, replacement, message) deprecated_constants[name] = {:replacement => replacement, :message => message} end
Generated with the Darkfish Rdoc Generator 2.