Class: Solace::Serializers::BaseDeserializer Abstract

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/solace/serializers/base_deserializer.rb

Overview

This class is abstract.

The base deserializer class

This class provides a consistent interface for deserializing records.

Since:

  • 0.0.1

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ BaseDeserializer

Initialize a new deserializer

Parameters:

  • io (IO, StringIO)

    The input to read bytes from.

Since:

  • 0.0.1



37
38
39
40
41
# File 'lib/solace/serializers/base_deserializer.rb', line 37

def initialize(io)
  super()
  @io = io
  @record = self.class.record_class.new
end

Class Attribute Details

.record_classObject

The class of the record being deserialized



62
63
64
# File 'lib/solace/serializers/base_deserializer.rb', line 62

def record_class
  @record_class
end

.stepsObject

An ordered list of methods to deserialize the record



56
57
58
# File 'lib/solace/serializers/base_deserializer.rb', line 56

def steps
  @steps
end

Instance Attribute Details

#ioIO, StringIO

Returns The input to read bytes from.

Returns:

  • (IO, StringIO)

    The input to read bytes from.

Since:

  • 0.0.1



25
26
27
# File 'lib/solace/serializers/base_deserializer.rb', line 25

def io
  @io
end

#recordRecord

Returns The deserialized record.

Returns:

  • (Record)

    The deserialized record.

Since:

  • 0.0.1



31
32
33
# File 'lib/solace/serializers/base_deserializer.rb', line 31

def record
  @record
end

Instance Method Details

#callRecord

Deserializes the record

Returns:

  • (Record)

    The deserialized record

Since:

  • 0.0.1



46
47
48
49
# File 'lib/solace/serializers/base_deserializer.rb', line 46

def call
  self.class.steps.each { send(_1) }
  record
end