Module: ActiveRecord::Enumerations::OptionsHelper
- Included in:
- ActiveRecord::Enum, ClassMethods, Factory
- Defined in:
- lib/ar_enums/options_helper.rb
Instance Method Summary collapse
- #add_option(config, option) ⇒ Object (also: #add_options)
- #extract_values_and_options(config) ⇒ Object
Instance Method Details
#add_option(config, option) ⇒ Object Also known as: add_options
4 5 6 7 8 9 10 11 |
# File 'lib/ar_enums/options_helper.rb', line 4 def add_option config, option new_config = if config.first.is_a?(Array) [config[0], (config[1] || {}).merge(option)] else [(config[0] || {}).merge(option)] end config.replace new_config end |
#extract_values_and_options(config) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/ar_enums/options_helper.rb', line 14 def config if config.first.is_a?(Array) [config[0], config[1] || {}] else [[], config[0] || {}] end end |