aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-06-18 15:00:58 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-06-18 15:00:58 -0500
commit55f8b0d09e3963f8d662c79952a1f9c3a0a4e1f3 (patch)
tree1a0a1f76a822e11cea9a8990e10b2f07d47e6d62
parente925d56529406cade161b4f453f34504ae0b3d62 (diff)
downloadrails-55f8b0d09e3963f8d662c79952a1f9c3a0a4e1f3.tar.gz
rails-55f8b0d09e3963f8d662c79952a1f9c3a0a4e1f3.tar.bz2
rails-55f8b0d09e3963f8d662c79952a1f9c3a0a4e1f3.zip
add example to AS::Deprecation#deprecate_methods [ci skip]
-rw-r--r--activesupport/lib/active_support/deprecation/method_wrappers.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/deprecation/method_wrappers.rb b/activesupport/lib/active_support/deprecation/method_wrappers.rb
index c5de5e6a95..257b70e34a 100644
--- a/activesupport/lib/active_support/deprecation/method_wrappers.rb
+++ b/activesupport/lib/active_support/deprecation/method_wrappers.rb
@@ -4,6 +4,26 @@ require 'active_support/core_ext/array/extract_options'
module ActiveSupport
module Deprecation
# Declare that a method has been deprecated.
+ #
+ # module Fred
+ # extend self
+ #
+ # def foo; end
+ # def bar; end
+ # def baz; end
+ # end
+ #
+ # ActiveSupport::Deprecation.deprecate_methods(Fred, :foo, bar: :qux, baz: 'use Bar#baz instead')
+ # # => [:foo, :bar, :baz]
+ #
+ # Fred.foo
+ # # => "DEPRECATION WARNING: foo is deprecated and will be removed from Rails 4.1."
+ #
+ # Fred.bar
+ # # => "DEPRECATION WARNING: bar is deprecated and will be removed from Rails 4.1 (use qux instead)."
+ #
+ # Fred.baz
+ # # => "DEPRECATION WARNING: baz is deprecated and will be removed from Rails 4.1 (use Bar#baz instead)."
def self.deprecate_methods(target_module, *method_names)
options = method_names.extract_options!
method_names += options.keys