diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-05-06 11:52:44 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-05-06 11:52:44 +0100 |
commit | a53331a161f72b25f6e9c860db43acaf23250f68 (patch) | |
tree | 782fda5754ab5e2489f0bb6f0650774c190be125 /activesupport/lib | |
parent | 2c39836dc3c06813fce031d1bb390149b53ebd1c (diff) | |
download | rails-a53331a161f72b25f6e9c860db43acaf23250f68.tar.gz rails-a53331a161f72b25f6e9c860db43acaf23250f68.tar.bz2 rails-a53331a161f72b25f6e9c860db43acaf23250f68.zip |
Add class to deprecate instance variables
Add ActiveSupport::Deprecation::DeprecatedInstanceVariable class to
deprecate instance variables of primitive types such as stings.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/deprecation.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index c9f1884da3..7613652c71 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -175,6 +175,20 @@ module ActiveSupport ActiveSupport::Deprecation.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", callstack) end end + + class DeprecatedInstanceVariable < Delegator #:nodoc: + 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 |