Sha256: a222ef6096b6db1f50ec26d54e19731445a73fe9149bc892f94c15fc185a614d

Contents?: true

Size: 506 Bytes

Versions: 3

Compression:

Stored size: 506 Bytes

Contents

module ArEnums
  module OptionsHelper
    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
    alias_method :add_options, :add_option
    
    def extract_values_and_options config
      if config.first.is_a?(Array)
        [config[0], config[1] || {}]
      else
        [[], config[0] || {}]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ar-enums-2.0.2 lib/ar_enums/options_helper.rb
ar-enums-2.0.1 lib/ar_enums/options_helper.rb
ar-enums-2.0.0 lib/ar_enums/options_helper.rb