Module: SimpleJSONSchema::Validators::Concerns::Format

Included in:
String
Defined in:
lib/simple_json_schema/validators/concerns/format.rb

Constant Summary collapse

EMAIL_REGEX =

this is no good

/\A[^@\s]+@([\p{L}\d-]+\.)+[\p{L}\d\-]{2,}\z/i.freeze
LABEL_REGEX_STRING =
'[\p{L}\p{N}]([\p{L}\p{N}\-]*[\p{L}\p{N}])?'
HOSTNAME_REGEX =
/\A(#{LABEL_REGEX_STRING}\.)*#{LABEL_REGEX_STRING}\z/i.freeze
DATE_TIME_OFFSET_REGEX =
/(Z|[+\-]([01][0-9]|2[0-3]):[0-5][0-9])\z/i.freeze
INVALID_QUERY_REGEX =
/[[:space:]]/.freeze
ASCII_REGEX =
/[^[:ascii:]]/.freeze

Instance Method Summary collapse

Instance Method Details

#valid_format(scope) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/simple_json_schema/validators/concerns/format.rb', line 15

def valid_format(scope)
  format = scope[:format]
  return if format.nil?
  return if valid_spec_format?(scope.value, format)

  scope.error(:format)
end