From 828914a062d3fd6cd51ebd3881acea11eede45cc Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 10 May 2008 10:47:06 -0500 Subject: Ruby 1.9 compat: define __setobj__ for Delegator --- activesupport/lib/active_support/deprecation.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support/deprecation.rb') diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index 7613652c71..e01ec92660 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -178,15 +178,19 @@ module ActiveSupport class DeprecatedInstanceVariable < Delegator #:nodoc: def initialize(value, method) - super(value) @method = method - @value = value + super(value) + __setobj__(value) end def __getobj__ ActiveSupport::Deprecation.warn("Instance variable @#{@method} is deprecated! Call instance method #{@method} instead.") @value end + + def __setobj__(value) + @value = value + end end end -- cgit v1.2.3 From 2270371f5dbabdd25ffcc59389249a795ba324a1 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Tue, 13 May 2008 10:39:45 +0100 Subject: Remove unnecessary DeprecatedInstanceVariable class --- activesupport/lib/active_support/deprecation.rb | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'activesupport/lib/active_support/deprecation.rb') diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index e01ec92660..6aa379b550 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -176,23 +176,6 @@ module ActiveSupport end end - class DeprecatedInstanceVariable < Delegator #:nodoc: - def initialize(value, method) - @method = method - super(value) - __setobj__(value) - end - - def __getobj__ - ActiveSupport::Deprecation.warn("Instance variable @#{@method} is deprecated! Call instance method #{@method} instead.") - @value - end - - def __setobj__(value) - @value = value - end - end - end end -- cgit v1.2.3