Class: GrpcKit::ProtoBuffer

Inherits:
Object
  • Object
show all
Defined in:
lib/grpc_kit/protobuffer.rb

Instance Method Summary collapse

Constructor Details

#initialize(encoder:, decoder:, encode_method:, decode_method:) ⇒ ProtoBuffer

Returns a new instance of ProtoBuffer

Parameters:


9
10
11
12
13
14
# File 'lib/grpc_kit/protobuffer.rb', line 9

def initialize(encoder:, decoder:, encode_method:, decode_method:)
  @encoder = encoder
  @decoder = decoder
  @encode_method = encode_method
  @decode_method = decode_method
end

Instance Method Details

#decode(data) ⇒ void

This method returns an undefined value.

Parameters:

  • data (String)

24
25
26
# File 'lib/grpc_kit/protobuffer.rb', line 24

def decode(data)
  @decoder.send(@decode_method, data)
end

#encode(data) ⇒ void

This method returns an undefined value.

Parameters:

  • data (String)

18
19
20
# File 'lib/grpc_kit/protobuffer.rb', line 18

def encode(data)
  @encoder.send(@encode_method, data)
end