Class: Grape::Validations::AsValidator

Inherits:
Base
  • Object
show all
Defined in:
lib/grape/validations/validators/as.rb

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

convert_to_short_name, #fail_fast?, inherited, #message, #options_key?, #validate, #validate!

Constructor Details

#initialize(attrs, options, required, scope, **opts) ⇒ AsValidator

Returns a new instance of AsValidator.


6
7
8
9
# File 'lib/grape/validations/validators/as.rb', line 6

def initialize(attrs, options, required, scope, **opts)
  @renamed_options = options
  super
end

Instance Method Details

#validate_param!(attr_name, params) ⇒ Object


11
12
13
# File 'lib/grape/validations/validators/as.rb', line 11

def validate_param!(attr_name, params)
  params[@renamed_options] = params[attr_name]
end