class SimpleJSONSchema::Validators::Boolean

Constants

BOOLEANS
FALSE_VALUES
TRUE_VALUES

Public Instance Methods

casting(value) click to toggle source
# File lib/simple_json_schema/validators/boolean.rb, line 17
def casting(value)
  return true if TRUE_VALUES.include?(value)
  return false if FALSE_VALUES.include?(value)
end
validate(scope) click to toggle source
# File lib/simple_json_schema/validators/boolean.rb, line 11
def validate(scope)
  value = scope.value

  return scope.error(:boolean) unless BOOLEANS.include?(value)
end