Module: AttrImmutable::ClassMethods
- Defined in:
- lib/attr_immutable.rb
Instance Method Summary collapse
Instance Method Details
#attr_immutable(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/attr_immutable.rb', line 10 def attr_immutable (*args) args.each do |arg| setter = "#{arg}=".to_sym define_method(arg) do self.attr_immutable(arg) self.send(arg) end define_method(setter) do |value| self.attr_immutable(arg) self.send(setter, value) end end end |