Sha256: 845da346e1c1aef968e28fcb59cfae8e4a2d6c3e7450c9f841f1440c9e0bb7fc
Contents?: true
Size: 755 Bytes
Versions: 12
Compression:
Stored size: 755 Bytes
Contents
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
12 entries across 12 versions & 1 rubygems