module Colppy::Utils

Constants

ATTRIBUTES_MAPPER
DATA_KEYS_SETTERS

Public Instance Methods

rename_params_hash(params, mapper, setter) click to toggle source
# File lib/colppy/utils.rb, line 8
def rename_params_hash(params, mapper, setter)
  params.each_with_object({}) do |(key, value), hash|
    if new_key = mapper[key]
      hash[new_key] = value
    elsif setter.include?(key)
      hash[key] = value
    else
      hash[:unhandle] ||= {}
      hash[:unhandle][key] = value
    end
  end
end