Module: RailsConditionalParams

Defined in:
lib/rails_conditional_params.rb,
lib/rails_conditional_params/version.rb,
lib/rails_conditional_params/alias_patch.rb,
lib/rails_conditional_params/prepend_patch.rb

Defined Under Namespace

Modules: AliasPatch, PrependPatch

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.restructure_filters!(filters) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rails_conditional_params.rb', line 14

def RailsConditionalParams.restructure_filters!(filters)
  filters.each do |filter|
    if filter.is_a? Hash
      filter.delete_if do |key, value|
        case value
        when TrueClass
          filters << key
          true
        when FalseClass, NilClass
          # do nothing
          true
        else
          false
        end
      end
    end
  end
end