Module: ListsConstant::ClassMethods
- Defined in:
- lib/lists_constant/class_methods.rb
Instance Method Summary collapse
Instance Method Details
#lists_constant(*values) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/lists_constant/class_methods.rb', line 5 def lists_constant *values = values. field = [:as].to_s raise ArgumentError.new('A constant name must be provided using the :as option') if field.empty? const_set field.upcase, values.freeze extend ListsConstant::Lookups::Class.new(field, values) include ListsConstant::Lookups::Instance.new(field, values) end |