aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-11-17 14:09:46 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-11-17 14:09:46 +0000
commit44e6aa7e19928f401e8728ddc2f4d7f6e3d6e105 (patch)
tree75bf4a68a1551d9abef216860c5f3070c409d2a1 /activesupport
parent38136d615e52d7c07c17d6aba03dc667b3302615 (diff)
downloadrails-44e6aa7e19928f401e8728ddc2f4d7f6e3d6e105.tar.gz
rails-44e6aa7e19928f401e8728ddc2f4d7f6e3d6e105.tar.bz2
rails-44e6aa7e19928f401e8728ddc2f4d7f6e3d6e105.zip
Improve readability.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5547 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/deprecation.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb
index 8960a03e66..b9c732691a 100644
--- a/activesupport/lib/active_support/deprecation.rb
+++ b/activesupport/lib/active_support/deprecation.rb
@@ -37,10 +37,9 @@ module ActiveSupport
@silenced
end
- # Silence deprecations for the duration of the provided block. For internal
- # use only.
+ # Silence deprecation warnings within the block.
def silence
- old_silenced, @silenced = @silenced, true # We could have done behavior = nil...
+ old_silenced, @silenced = @silenced, true
yield
ensure
@silenced = old_silenced
@@ -153,13 +152,17 @@ module ActiveSupport
end
private
- def warn(callstack, called, args)
- ActiveSupport::Deprecation.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", callstack)
- end
-
def method_missing(called, *args, &block)
warn caller, called, args
- @instance.__send__(@method).__send__(called, *args, &block)
+ target.__send__(called, *args, &block)
+ end
+
+ def target
+ @instance.__send__(@method)
+ end
+
+ def warn(callstack, called, args)
+ ActiveSupport::Deprecation.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", callstack)
end
end
end