lib/active_support/deprecation.rb in activesupport-1.4.4 vs lib/active_support/deprecation.rb in activesupport-2.0.0
- old
+ new
@@ -83,11 +83,11 @@
self.silenced = false
module ClassMethods #:nodoc:
# Declare that a method has been deprecated.
def deprecate(*method_names)
- options = method_names.last.is_a?(Hash) ? method_names.pop : {}
+ options = method_names.extract_options!
method_names = method_names + options.keys
method_names.each do |method_name|
alias_method_chain(method_name, :deprecation) do |target, punctuation|
class_eval(<<-EOS, __FILE__, __LINE__)
def #{target}_with_deprecation#{punctuation}(*args, &block)
@@ -145,10 +145,12 @@
end
# Stand-in for @request, @attributes, @params, etc which emits deprecation
# warnings on any method call (except #inspect).
class DeprecatedInstanceVariableProxy #:nodoc:
- instance_methods.each { |m| undef_method m unless m =~ /^__/ }
+ silence_warnings do
+ instance_methods.each { |m| undef_method m unless m =~ /^__/ }
+ end
def initialize(instance, method, var = "@#{method}")
@instance, @method, @var = instance, method, var
end