Class: Avrocado::Deserializer

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, schema = Schema.parse) ⇒ Deserializer

Returns a new instance of Deserializer.



5
6
7
8
# File 'lib/avrocado/deserializer.rb', line 5

def initialize(message, schema = Schema.parse)
  @message = message
  @schema  = schema
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/avrocado/deserializer.rb', line 3

def message
  @message
end

#schemaObject (readonly)

Returns the value of attribute schema.



3
4
5
# File 'lib/avrocado/deserializer.rb', line 3

def schema
  @schema
end

Class Method Details

.deserialize(message) ⇒ Object



10
11
12
# File 'lib/avrocado/deserializer.rb', line 10

def self.deserialize(message)
  new(message).deserialize
end

Instance Method Details

#deserializeObject



14
15
16
# File 'lib/avrocado/deserializer.rb', line 14

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