Sha256: 280db0cff0cafebae22b1d9ff189c6088401c0c6cd4cdd88d6ec91b440a7ddba
Contents?: true
Size: 601 Bytes
Versions: 16
Compression:
Stored size: 601 Bytes
Contents
class OpenAPIParser::SchemaValidator class BooleanValidator < Base TRUE_VALUES = ['true', '1'].freeze FALSE_VALUES = ['false', '0'].freeze def coerce_and_validate(value, schema, **_keyword_args) value = coerce(value) if @coerce_value return OpenAPIParser::ValidateError.build_error_result(value, schema) unless value.kind_of?(TrueClass) || value.kind_of?(FalseClass) [value, nil] end private def coerce(value) return true if TRUE_VALUES.include?(value) return false if FALSE_VALUES.include?(value) value end end end
Version data entries
16 entries across 16 versions & 1 rubygems