提交 828914a0 编写于 作者: J Jeremy Kemper

Ruby 1.9 compat: define __setobj__ for Delegator

上级 d2212c16
...@@ -178,15 +178,19 @@ def warn(callstack, called, args) ...@@ -178,15 +178,19 @@ def warn(callstack, called, args)
class DeprecatedInstanceVariable < Delegator #:nodoc: class DeprecatedInstanceVariable < Delegator #:nodoc:
def initialize(value, method) def initialize(value, method)
super(value)
@method = method @method = method
@value = value super(value)
__setobj__(value)
end end
def __getobj__ def __getobj__
ActiveSupport::Deprecation.warn("Instance variable @#{@method} is deprecated! Call instance method #{@method} instead.") ActiveSupport::Deprecation.warn("Instance variable @#{@method} is deprecated! Call instance method #{@method} instead.")
@value @value
end end
def __setobj__(value)
@value = value
end
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册