Class: JSONSkooma::Validators::JSONPointer

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

Constant Summary collapse

ESC =
/~[01]/
UNESC =
/[\u0000-\u002E\u0030-\u007d\u007F-\u{10FFFF}]/
TOKEN =
/(#{ESC}|#{UNESC})*/
JSON_POINTER =
/(\/#{TOKEN})*/
REGEXP =
/\A#{JSON_POINTER}\z/

Instance Method Summary collapse

Methods inherited from Base

assert?, call, inherited

Instance Method Details

#call(data) ⇒ Object

Raises:



12
13
14
15
16
# File 'lib/json_skooma/validators/json_pointer.rb', line 12

def call(data)
  return if REGEXP.match?(data)

  raise FormatError, "#{data} is not a valid JSON pointer"
end