Module: Reaction::HasAttributes::ClassMethods
- Defined in:
- lib/reaction/has_attributes.rb
Instance Method Summary collapse
Instance Method Details
#attribute(name) ⇒ Object
8 9 10 11 12 |
# File 'lib/reaction/has_attributes.rb', line 8 def attribute(name) attr_accessor name eval(getter_code(name)) attributes << name end |
#attributes ⇒ Object
14 15 16 |
# File 'lib/reaction/has_attributes.rb', line 14 def attributes @attributes ||= [] end |
#getter_code(name) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/reaction/has_attributes.rb', line 18 def getter_code(name) " def \#{name}\n self.\#{name}\n end\n" end |