Module: Wallaby::ParamsUtils

Defined in:
lib/utils/wallaby/params_utils.rb

Overview

Hash utils

Class Method Summary collapse

Class Method Details

.presence(*params) ⇒ Hash

Returns combined hash that removes empty values.

Parameters:

  • params (Array<Hash>)

Returns:

  • (Hash)

    combined hash that removes empty values



9
10
11
# File 'lib/utils/wallaby/params_utils.rb', line 9

def presence(*params)
  params.reduce({}, :merge).delete_if { |_, v| v.nil? || v == '' }
end