lib/active_support/deprecation.rb in activesupport-2.0.2 vs lib/active_support/deprecation.rb in activesupport-2.0.4

- old
+ new

@@ -1,6 +1,7 @@ require 'yaml' +require 'delegate' module ActiveSupport module Deprecation #:nodoc: mattr_accessor :debug self.debug = false @@ -173,9 +174,23 @@ def warn(callstack, called, args) ActiveSupport::Deprecation.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", callstack) end end + + class DeprecatedInstanceVariable < Delegator + def initialize(value, method) + super(value) + @method = method + @value = value + end + + def __getobj__ + ActiveSupport::Deprecation.warn("Instance variable @#{@method} is deprecated! Call instance method #{@method} instead.") + @value + end + end + end end class Module include ActiveSupport::Deprecation::ClassMethods