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 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/reaction/has_attributes.rb', line 14 def attributes if self == Reaction::Action @attributes ||= [] else @attributes ||= begin attrs = superclass.attributes if attrs.respond_to?(:deep_dup) attrs.deep_dup else attrs.dup end end end end |
#getter_code(name) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/reaction/has_attributes.rb', line 29 def getter_code(name) <<-CODE def #{name} self.#{name} end CODE end |