Class: Avrocado::Decoder

Inherits:
Object
  • Object
show all
Defined in:
lib/avrocado/deserializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, schema) ⇒ Decoder

Returns a new instance of Decoder.



21
22
23
24
# File 'lib/avrocado/deserializer.rb', line 21

def initialize(message, schema)
  @message = message.is_a?(String) ? message.to_java_bytes : message
  @schema  = schema
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



19
20
21
# File 'lib/avrocado/deserializer.rb', line 19

def message
  @message
end

#schemaObject (readonly)

Returns the value of attribute schema.



19
20
21
# File 'lib/avrocado/deserializer.rb', line 19

def schema
  @schema
end

Instance Method Details

#decodedObject



26
27
28
# File 'lib/avrocado/deserializer.rb', line 26

def decoded
  JSON.parse reader.read(nil, decoder).to_s
end