Class: InputSanitizer::V2::Types::CoercingBooleanCheck

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

Instance Method Summary collapse

Instance Method Details

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



128
129
130
131
132
133
134
135
136
# File 'lib/input_sanitizer/v2/types.rb', line 128

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