Class: Avrocado::Serializer
- Inherits:
-
Object
- Object
- Avrocado::Serializer
- Defined in:
- lib/avrocado/serializer.rb
Instance Attribute Summary collapse
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(schema) ⇒ Serializer
constructor
A new instance of Serializer.
- #serialize(message) ⇒ Object
Constructor Details
#initialize(schema) ⇒ Serializer
Returns a new instance of Serializer.
5 6 7 |
# File 'lib/avrocado/serializer.rb', line 5 def initialize(schema) @schema = schema end |
Instance Attribute Details
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
3 4 5 |
# File 'lib/avrocado/serializer.rb', line 3 def schema @schema end |
Class Method Details
.serialize(message, schema) ⇒ Object
9 10 11 |
# File 'lib/avrocado/serializer.rb', line 9 def self.serialize(, schema) new(schema).serialize() end |
Instance Method Details
#serialize(message) ⇒ Object
13 14 15 |
# File 'lib/avrocado/serializer.rb', line 13 def serialize() Avrocado::Encoder.new(, schema).encoded end |