Class: AvroTurf::MutableSchemaStore

Inherits:
SchemaStore show all
Defined in:
lib/avro_turf/mutable_schema_store.rb

Overview

A schema store that allows you to add or remove schemas, and to access them externally.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SchemaStore

#find, #initialize, #load_schemas!

Constructor Details

This class inherits a constructor from AvroTurf::SchemaStore

Instance Attribute Details

#schemasObject

Returns the value of attribute schemas.



7
8
9
# File 'lib/avro_turf/mutable_schema_store.rb', line 7

def schemas
  @schemas
end

Instance Method Details

#add_schema(schema_hash) ⇒ Object

Parameters:

  • schema_hash (Hash)


10
11
12
13
14
15
16
# File 'lib/avro_turf/mutable_schema_store.rb', line 10

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