lib/active_support/deprecation.rb in activesupport-2.1.2 vs lib/active_support/deprecation.rb in activesupport-2.2.2
- old
+ new
@@ -49,12 +49,12 @@
attr_writer :silenced
private
def deprecation_message(callstack, message = nil)
- message ||= "You are using deprecated behavior which will be removed from Rails 2.2"
- "DEPRECATION WARNING: #{message} See http://www.rubyonrails.org/deprecation for details. #{deprecation_caller_message(callstack)}"
+ message ||= "You are using deprecated behavior which will be removed from the next major or minor release."
+ "DEPRECATION WARNING: #{message}. #{deprecation_caller_message(callstack)}"
end
def deprecation_caller_message(callstack)
file, line, method = extract_callstack(callstack)
if file
@@ -90,11 +90,11 @@
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)
::ActiveSupport::Deprecation.warn(self.class.deprecated_method_warning(:#{method_name}, #{options[method_name].inspect}), caller)
- send(:#{target}_without_deprecation#{punctuation}, *args, &block)
+ #{target}_without_deprecation#{punctuation}(*args, &block)
end
EOS
end
end
end
@@ -107,11 +107,11 @@
else warning
end
end
def deprecation_horizon
- '2.2'
+ '2.3'
end
end
module Assertions #:nodoc:
def assert_deprecated(match = nil, &block)
@@ -160,10 +160,26 @@
warn caller, called, args
target.__send__(called, *args, &block)
end
end
+ class DeprecatedObjectProxy < DeprecationProxy
+ def initialize(object, message)
+ @object = object
+ @message = message
+ end
+
+ private
+ def target
+ @object
+ end
+
+ def warn(callstack, called, args)
+ ActiveSupport::Deprecation.warn(@message, callstack)
+ end
+ end
+
# Stand-in for <tt>@request</tt>, <tt>@attributes</tt>, <tt>@params</tt>, etc.
# which emits deprecation warnings on any method call (except +inspect+).
class DeprecatedInstanceVariableProxy < DeprecationProxy #:nodoc:
def initialize(instance, method, var = "@#{method}")
@instance, @method, @var = instance, method, var
@@ -181,9 +197,13 @@
class DeprecatedConstantProxy < DeprecationProxy #:nodoc:
def initialize(old_const, new_const)
@old_const = old_const
@new_const = new_const
+ end
+
+ def class
+ target.class
end
private
def target
@new_const.to_s.constantize