From 71993c6f9770b1350aa41fe8c68f1dd2c7800403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Nie=C5=82acny?= Date: Thu, 13 Sep 2012 08:38:34 +0200 Subject: Change ActiveSupport::Deprecation to class. ActiveSupport::Deprecation is now a class rather than a module. You can get instance of ActiveSupport::Deprecation calling #instance method. ActiveSupport::Deprecation.instance But when you need to get new object od ActiveSupport::Deprecation you need to just call #new. @instance = ActiveSupport::Deprecation.new Since you can create a new object, you can change the version and the name of the library where the deprecator concerned. ActiveSupport::Deprecation.new('2.0', 'MyGem') If you need use another deprecator instance you can select it in the options of deprecate method. deprecate :method, :deprecator => deprecator_instance Documentation has been updated. --- activesupport/CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'activesupport/CHANGELOG.md') diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 3914f4dc4c..6dff6de83a 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,5 +1,37 @@ ## Rails 4.0.0 (unreleased) ## +* ActiveSupport::Deprecation is now a class. It is possible to create an instance + of deprecator. Backwards compatibility has been preserved. + + You can choose which instance of the deprecator will be used. + + deprecate :method_name, :deprecator => deprecator_instance + + You can use ActiveSupport::Deprecation in your gem. + + require 'active_support/deprecation' + require 'active_support/core_ext/module/deprecation' + + class MyGem + def old_method + end + deprecate :old_method => :new_method, :deprecator => deprecator + + def new_method + end + + def self.deprecator + ActiveSupport::Deprecation.new('2.0', 'MyGem') + end + end + + MyGem.new.old_method + + DEPRECATION WARNING: old_method is deprecated and will be removed from MyGem 2.0 + (use new_method instead). (called from
at file.rb:18) + + *Piotr Niełacny & Robert Pankowecki* + * `ERB::Util.html_escape` encodes single quote as `#39`. Decimal form has better support in old browsers. *Kalys Osmonov* * `ActiveSupport::Callbacks`: deprecate monkey patch of object callbacks. -- cgit v1.2.3