Sha256: 37f708ae3d5fe9a9ff6e64412aa4014a5ba7c36d0905d0f3485f563eec8cad1e
Contents?: true
Size: 786 Bytes
Versions: 7
Compression:
Stored size: 786 Bytes
Contents
# frozen_string_literal: true module Avro module Builder # This class implements a schema store that loads Avro::Builder # DSL files and returns Avro::Schema objects. # It implements the same API as AvroTurf::SchemaStore. class SchemaStore def initialize(path: nil) Avro::Builder.add_load_path(path) if path @schemas = {} end def find(name, namespace = nil) fullname = Avro::Name.make_fullname(name, namespace) @schemas[fullname] ||= Avro::Builder::DSL.new { eval_file(fullname) } .as_schema.tap do |schema| if schema.respond_to?(:fullname) && schema.fullname != fullname raise SchemaError.new(schema.fullname, fullname) end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems