Module: Mixture::Extensions::Attributable::ClassMethods
- Defined in:
- lib/mixture/extensions/attributable.rb
Overview
The class methods for attribution.
Instance Method Summary collapse
Instance Method Details
#attribute(name, options = {}) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/mixture/extensions/attributable.rb', line 9 def attribute(name, = {}) name = name.to_s.intern attr = attributes.create(name, ) define_method(attr.getter) { attribute(name) } define_method(attr.setter) { |v| attribute(name, v) } attr end |
#attributes ⇒ Object
17 18 19 |
# File 'lib/mixture/extensions/attributable.rb', line 17 def attributes @_attributes ||= AttributeList.new end |