Skip to content

attr_accessor_with_default #52

Closed
wants to merge 1 commit into from
View
8 activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb
@@ -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
Something went wrong with that request. Please try again.