Sha256: 45d7cf6eaca0255fee168f89f60f73af9a4b8f9e90f18ed335750e40a3719a67
Contents?: true
Size: 623 Bytes
Versions: 1
Compression:
Stored size: 623 Bytes
Contents
require 'active_support/core_ext' module ParamsPurifier module Purification module_function def execute(params) purify_params(params, {}) end def purify_params(original_params, new_params) original_params.each_with_object(new_params) do |(key, value), purified_params| case value when Array new_value = value.reject { |v| v.blank? } when Hash new_value = purify_params(value, {}) else new_value = value end purified_params[key] = new_value end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
params_purifier-0.0.1 | lib/params_purifier/purification.rb |