Class: Class
- Inherits:
-
Object
- Object
- Class
- Defined in:
- lib/node/node.rb
Instance Method Summary collapse
-
#attr_for_disp(attribute) ⇒ Object
use this instead of attr_accessor.
Instance Method Details
#attr_for_disp(attribute) ⇒ Object
use this instead of attr_accessor. if attribute is changed call Node#update
6 7 8 9 10 11 12 13 14 |
# File 'lib/node/node.rb', line 6 def attr_for_disp(attribute) define_method "#{attribute}=" do |value| instance_variable_set("@#{attribute}", value) update_for_display end define_method attribute do instance_variable_get "@#{attribute}" end end |