Class: InputSanitizer::V2::Types::BooleanCheck

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

Instance Method Summary collapse

Instance Method Details

#call(value, options = {}) ⇒ Object



116
117
118
119
120
121
122
123
124
# File 'lib/input_sanitizer/v2/types.rb', line 116

def call(value, options = {})
  if value == nil
    raise InputSanitizer::BlankValueError
  elsif [true, false].include?(value)
    value
  else
    raise InputSanitizer::TypeMismatchError.new(value, :boolean)
  end
end