class JsonMatchers::Parser

Attributes

schema_path[R]

Public Class Methods

new(schema_path) click to toggle source
# File lib/json_matchers/parser.rb, line 3
def initialize(schema_path)
  @schema_path = schema_path
end

Public Instance Methods

parse() click to toggle source
# File lib/json_matchers/parser.rb, line 7
def parse
  JsonSchema.parse!(schema_data)
rescue JSON::ParserError, JsonSchema::SchemaError => error
  raise InvalidSchemaError.new(error)
end

Private Instance Methods

schema_data() click to toggle source
# File lib/json_matchers/parser.rb, line 17
def schema_data
  JSON.parse(schema_path.read)
end