diff options
Diffstat (limited to 'lib/chef/mixin/deprecation.rb')
-rw-r--r-- | lib/chef/mixin/deprecation.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/chef/mixin/deprecation.rb b/lib/chef/mixin/deprecation.rb index 14414036e7..6621555585 100644 --- a/lib/chef/mixin/deprecation.rb +++ b/lib/chef/mixin/deprecation.rb @@ -23,24 +23,24 @@ class Chef @deprecated_constants ||= {} end - # Add a deprecated constant to the Chef::Mixin namespace. - # === Arguments - # * name: the constant name, as a relative symbol. - # * replacement: the constant to return instead. - # * message: A message telling the user what to do instead. - # === Example: - # deprecate_constant(:RecipeDefinitionDSLCore, Chef::DSL::Recipe, <<-EOM) - # Chef::Mixin::RecipeDefinitionDSLCore is deprecated, use Chef::DSL::Recipe instead. - # EOM + # Add a deprecated constant to the Chef::Mixin namespace. + # + # @param name [Symbol] the constant name, as a relative symbol. + # @param replacement [Object] the constant to return instead. + # @param message [String] A message telling the user what to do instead. + # @example + # deprecate_constant(:RecipeDefinitionDSLCore, Chef::DSL::Recipe, <<-EOM) + # Chef::Mixin::RecipeDefinitionDSLCore is deprecated, use Chef::DSL::Recipe instead. + # EOM def self.deprecate_constant(name, replacement, message) deprecated_constants[name] = { :replacement => replacement, :message => message } end - # 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. + # 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. def self.const_missing(name) if new_const = deprecated_constants[name] Chef::Log.warn(new_const[:message]) |