Class: AvroTurf::SchemaStore

Inherits:
Object
  • Object
show all
Defined in:
lib/deimos/monkey_patches/schema_store.rb

Overview

Allows us to add in-memory schemas to the schema store in addition to the ones stored in the file system.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#schemasObject

Returns the value of attribute schemas.



8
9
10
# File 'lib/deimos/monkey_patches/schema_store.rb', line 8

def schemas
  @schemas
end

Instance Method Details

#add_schema(schema_hash) ⇒ Object

Parameters:

  • schema_hash (Hash)


11
12
13
14
15
16
17
18
# File 'lib/deimos/monkey_patches/schema_store.rb', line 11

def add_schema(schema_hash)
  name = schema_hash['name']
  namespace = schema_hash['namespace']
  full_name = Avro::Name.make_fullname(name, namespace)
  return if @schemas.key?(full_name)

  Avro::Schema.real_parse(schema_hash, @schemas)
end