Class: Thrift::Types::Known::Any::MetaCodec
- Inherits:
-
Object
- Object
- Thrift::Types::Known::Any::MetaCodec
- Defined in:
- lib/thrift/types/known/any/any.rb
Instance Method Summary collapse
- #decode(buf, obj) ⇒ Object
- #encode(obj) ⇒ Object
-
#initialize(klass) ⇒ MetaCodec
constructor
A new instance of MetaCodec.
Constructor Details
#initialize(klass) ⇒ MetaCodec
Returns a new instance of MetaCodec.
22 23 24 |
# File 'lib/thrift/types/known/any/any.rb', line 22 def initialize(klass) @klass = klass end |
Instance Method Details
#decode(buf, obj) ⇒ Object
30 31 32 |
# File 'lib/thrift/types/known/any/any.rb', line 30 def decode(buf, obj) from_hash(obj, @klass.load(buf)) end |
#encode(obj) ⇒ Object
26 27 28 |
# File 'lib/thrift/types/known/any/any.rb', line 26 def encode(obj) @klass.dump(to_hash(obj)) end |