Sha256: 9a3fd4de9b1309d646b11d9179537302e9902b5a461624222edf5a8aac16c412

Contents?: true

Size: 577 Bytes

Versions: 11

Compression:

Stored size: 577 Bytes

Contents

module ActiveRecord
  module Enumerations
    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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ar-enums-1.0.0 lib/ar_enums/options_helper.rb
ar-enums-0.3.9 lib/ar_enums/options_helper.rb
ar-enums-0.3.8 lib/ar_enums/options_helper.rb
ar-enums-0.3.7 lib/ar_enums/options_helper.rb
ar-enums-0.3.6 lib/ar_enums/options_helper.rb
ar-enums-0.3.5 lib/ar_enums/options_helper.rb
ar-enums-0.3.4 lib/options_helper.rb
ar-enums-0.3.3 lib/options_helper.rb
ar-enums-0.3.2 lib/options_helper.rb
ar-enums-0.3.1 lib/options_helper.rb
ar-enums-0.3.0 lib/options_helper.rb