Sha256: b8b94d7beb97c23c1e8d888b5fdb4f3a3fccbda425e6564679de1d8ed4d36185

Contents?: true

Size: 710 Bytes

Versions: 17

Compression:

Stored size: 710 Bytes

Contents

module MoneyRails
  module ActiveRecord
    module MigrationExtensions
      class OptionsExtractor
        def self.extract(attribute, table_name, accessor, options = {})
          default = MoneyRails::Configuration.send("#{attribute}_column").merge(options[attribute] || {})

          default[:column_name] ||= [default[:prefix], accessor, default[:postfix]].join
          default[:table_name] = table_name

          excluded_keys = [:amount, :currency, :type, :prefix, :postfix, :present, :column_name, :table_name]
          default[:options] = default.except(*excluded_keys)

          default.slice(:present, :table_name, :column_name, :type, :options).values
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
money-rails-1.15.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.14.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.13.4 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.13.3 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.13.2 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.13.1 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.13.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.12.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.11.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.10.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.9.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.8.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.7.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.6.2 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.6.1 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.6.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb
money-rails-1.5.0 lib/money-rails/active_record/migration_extensions/options_extractor.rb