Module: Enumitation::ClassMethods
- Defined in:
- lib/enumitation/class_methods.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/enumitation/class_methods.rb', line 4 def self.extended(base) # If we've already been extended, don't do it again return if defined? base.enumitation_values class << base attr_accessor :enumitation_values end base.enumitation_values = {} end |
Instance Method Details
#select_options_for(attribute) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/enumitation/class_methods.rb', line 15 def (attribute) return [] if enumitation_values.empty? enumitation_values[attribute].map do |val| [display_value(attribute, val), val] end end |