Class: AvroParser
- Inherits:
-
Object
- Object
- AvroParser
- Defined in:
- lib/stream_reader/avro_parser.rb
Instance Method Summary collapse
- #each_with_schema_name ⇒ Object
-
#initialize(data) ⇒ AvroParser
constructor
A new instance of AvroParser.
Constructor Details
#initialize(data) ⇒ AvroParser
Returns a new instance of AvroParser.
4 5 6 |
# File 'lib/stream_reader/avro_parser.rb', line 4 def initialize(data) @data = data end |
Instance Method Details
#each_with_schema_name ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/stream_reader/avro_parser.rb', line 8 def each_with_schema_name buffer = StringIO.new(@data) reader = Avro::DataFile::Reader.new(buffer, Avro::IO::DatumReader.new) reader.each do |record| schema_name = reader.datum_reader.readers_schema.name yield record, schema_name end end |