mirror of
https://github.com/github/rails.git
synced 2026-01-10 23:27:56 -05:00
Fix 'warning: method redefined' [#5551 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
committed by
José Valim
parent
8639c10a40
commit
1b7d30bfc9
@@ -21,10 +21,10 @@ class Module
|
||||
def attr_accessor_with_default(sym, default = Proc.new)
|
||||
define_method(sym, block_given? ? default : Proc.new { default })
|
||||
module_eval(<<-EVAL, __FILE__, __LINE__ + 1)
|
||||
def #{sym}=(value) # def age=(value)
|
||||
class << self; attr_reader :#{sym} end # class << self; attr_reader :age end
|
||||
@#{sym} = value # @age = value
|
||||
end # end
|
||||
def #{sym}=(value) # def age=(value)
|
||||
class << self; attr_accessor :#{sym} end # class << self; attr_accessor :age end
|
||||
@#{sym} = value # @age = value
|
||||
end # end
|
||||
EVAL
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user