Sha256: 9e2e405b1fa924d4ab7884de4fcfca14231067ee93c134f3683e91449ac4a694

Contents?: true

Size: 390 Bytes

Versions: 3

Compression:

Stored size: 390 Bytes

Contents

module JsonMatchers
  class Parser
    def initialize(schema_path)
      @schema_path = schema_path
    end

    def parse
      JsonSchema.parse!(schema_data)
    rescue JSON::ParserError, JsonSchema::SchemaError => error
      raise InvalidSchemaError.new(error)
    end

    private

    attr_reader :schema_path

    def schema_data
      JSON.parse(schema_path.read)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
json_matchers-0.11.1 lib/json_matchers/parser.rb
json_matchers-0.11.0 lib/json_matchers/parser.rb
json_matchers-0.10.0 lib/json_matchers/parser.rb