Class: InputSanitizer::V2::CleanField

Inherits:
Object
  • Object
show all
Defined in:
lib/input_sanitizer/v2/clean_field.rb

Instance Method Summary collapse

Instance Method Details

#callObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/input_sanitizer/v2/clean_field.rb', line 2

def call
  if has_key
    convert
  elsif default
    converter.call(default, options)
  elsif options[:required]
    raise InputSanitizer::ValueMissingError
  else
    raise InputSanitizer::OptionalValueOmitted
  end
end