Permalink
Browse files

Ruby 1.9 compat: define __setobj__ for Delegator

  • Loading branch information...
jeremy committed May 10, 2008
1 parent d2212c1 commit 828914a062d3fd6cd51ebd3881acea11eede45cc
Showing with 6 additions and 2 deletions.
  1. +6 −2 activesupport/lib/active_support/deprecation.rb
@@ -178,15 +178,19 @@ def warn(callstack, called, args)
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

0 comments on commit 828914a

Please sign in to comment.