Module: ParameterNormalizer::ControllerConcerns::Normalizable

Extended by:
ActiveSupport::Concern
Defined in:
lib/parameter_normalizer/controller_concerns/normalizable.rb

Instance Method Summary collapse

Instance Method Details

#normalize_parameter(key, method, skip_key_not_found: true) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/parameter_normalizer/controller_concerns/normalizable.rb', line 10

def normalize_parameter(key, method, skip_key_not_found: true)
  if skip_key_not_found
    return unless params.key?(key)
  end

  params[key] = parameter_normalizer.public_send(method, params[key])
end

#parameter_normalizerObject



6
7
8
# File 'lib/parameter_normalizer/controller_concerns/normalizable.rb', line 6

def parameter_normalizer
  @parameter_normalizer ||= ParameterNormalizer::Normalizer.new
end