Class: Thrift::Types::Known::Any::ProtocolCodec
- Inherits:
-
Object
- Object
- Thrift::Types::Known::Any::ProtocolCodec
- Defined in:
- lib/thrift/types/known/any/any.rb
Instance Method Summary collapse
- #decode(buf, obj) ⇒ Object
- #encode(obj) ⇒ Object
-
#initialize(protocol_factory) ⇒ ProtocolCodec
constructor
A new instance of ProtocolCodec.
Constructor Details
#initialize(protocol_factory) ⇒ ProtocolCodec
Returns a new instance of ProtocolCodec.
94 95 96 |
# File 'lib/thrift/types/known/any/any.rb', line 94 def initialize(protocol_factory) @protocol_factory = protocol_factory end |
Instance Method Details
#decode(buf, obj) ⇒ Object
102 103 104 105 106 |
# File 'lib/thrift/types/known/any/any.rb', line 102 def decode(buf, obj) obj.read( @protocol_factory.get_protocol(MemoryBufferTransport.new(buf)) ) end |
#encode(obj) ⇒ Object
98 99 100 |
# File 'lib/thrift/types/known/any/any.rb', line 98 def encode(obj) Serializer.new(@protocol_factory).serialize(obj) end |