Class: JSONSkooma::Validators::RelativeJSONPointer

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

Constant Summary collapse

NN_INT =
/0|[1-9][0-9]*/
INDEX =
/[+-]#{NN_INT}/
RELATIVE_JSON_POINTER =
/(#{NN_INT}(#{INDEX})?#{JSONPointer::JSON_POINTER})|(#{NN_INT}#)/
REGEXP =
/\A#{RELATIVE_JSON_POINTER}\z/

Instance Method Summary collapse

Methods inherited from Base

assert?, call, inherited

Instance Method Details

#call(data) ⇒ Object

Raises:



11
12
13
14
15
# File 'lib/json_skooma/validators/relative_json_pointer.rb', line 11

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

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