Class: JSONSkooma::Validators::Time

Inherits:
Base
  • Object
show all
Defined in:
lib/json_skooma/validators/time.rb

Constant Summary collapse

REGEXP =
/\A#{DateTime::FULL_TIME}\z/

Instance Method Summary collapse

Methods inherited from Base

assert?, call, inherited

Instance Method Details

#call(data) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/json_skooma/validators/time.rb', line 8

def call(data)
  match = REGEXP.match(data)

  if match.nil? || !valid_leap_seconds?(match)
    raise FormatError, "must be a valid RFC 3339 time string"
  end
end