Class: GrpcKit::Codec
- Inherits:
-
Object
- Object
- GrpcKit::Codec
- Defined in:
- lib/grpc_kit/codec.rb
Instance Method Summary collapse
- #decode(data) ⇒ String
- #encode(data) ⇒ String
-
#initialize(marshal:, unmarshal:, marshal_method:, unmarshal_method:) ⇒ Codec
constructor
A new instance of Codec.
Constructor Details
#initialize(marshal:, unmarshal:, marshal_method:, unmarshal_method:) ⇒ Codec
Returns a new instance of Codec.
9 10 11 12 13 14 |
# File 'lib/grpc_kit/codec.rb', line 9 def initialize(marshal:, unmarshal:, marshal_method:, unmarshal_method:) @marshal = marshal @unmarshal = unmarshal @marshal_method = marshal_method @unmarshal_method = unmarshal_method end |
Instance Method Details
#decode(data) ⇒ String
24 25 26 |
# File 'lib/grpc_kit/codec.rb', line 24 def decode(data) @unmarshal.send(@unmarshal_method, data) end |
#encode(data) ⇒ String
18 19 20 |
# File 'lib/grpc_kit/codec.rb', line 18 def encode(data) @marshal.send(@marshal_method, data) end |