Class/Module Index [+]

Quicksearch

Grape::Validations::CoerceValidator

Public Instance Methods

validate_param!(attr_name, params) click to toggle source
# File lib/grape/validations/coerce.rb, line 8
def validate_param!(attr_name, params)
  raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message_key: :coerce unless params.is_a? Hash
  new_value = coerce_value(@option, params[attr_name])
  if valid_type?(new_value)
    params[attr_name] = new_value
  else
    raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message_key: :coerce
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.