Module: Enumerize::Base::ClassMethods
- Defined in:
- lib/enumerize/base.rb
Defined Under Namespace
Modules: Hook
Instance Method Summary collapse
Instance Method Details
#enumerize(name, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/enumerize/base.rb', line 15 def enumerize(name, ={}) attr = Attribute.new(self, name, ) enumerized_attributes << attr unless methods.include?(attr.name) _enumerize_module._class_methods.module_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{attr.name} enumerized_attributes[:#{attr.name}] end RUBY end attr.define_methods!(_enumerize_module) end |
#enumerized_attributes ⇒ Object
30 31 32 |
# File 'lib/enumerize/base.rb', line 30 def enumerized_attributes @enumerized_attributes ||= AttributeMap.new end |