Class: MundaneSearch::Filters::BlankParamsAreNil

Inherits:
Base
  • Object
show all
Defined in:
lib/mundane-search/filters/blank_params_are_nil.rb

Instance Attribute Summary

Attributes inherited from Base

#collection, #options, #params

Instance Method Summary collapse

Methods inherited from Base

#apply?, #call, #filtered_collection, #initialize

Constructor Details

This class inherits a constructor from MundaneSearch::Filters::Base

Instance Method Details

#filtered_paramsObject



3
4
5
6
7
8
9
# File 'lib/mundane-search/filters/blank_params_are_nil.rb', line 3

def filtered_params
  params.inject({}) do |hash,e|
    val = e.last
    hash[e.first] = val.empty? ? nil : val
    hash
  end
end