1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Improve readability.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5547 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2006-11-17 14:09:46 +00:00
parent 38136d615e
commit 44e6aa7e19

View file

@ -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