Sha256: 418b5717a7b53c479aca8bd4a0f0256fe70bf382e1e80a03cc0368ad7314684a

Contents?: true

Size: 695 Bytes

Versions: 7

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true

module GrpcKit
  class ProtoBuffer
    # @param encoder [Class, GrpcKit::GRPC::Stream]
    # @param decoder [Class, GrpcKit::GRPC::Stream]
    # @param encode_method [Symbol]
    # @param decode_method [Symbol]
    def initialize(encoder:, decoder:, encode_method:, decode_method:)
      @encoder = encoder
      @decoder = decoder
      @encode_method = encode_method
      @decode_method = decode_method
    end

    # @param data [String]
    # @return [void]
    def encode(data)
      @encoder.send(@encode_method, data)
    end

    # @param data [String]
    # @return [void]
    def decode(data)
      @decoder.send(@decode_method, data)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
grpc_kit-0.2.0 lib/grpc_kit/protobuffer.rb
grpc_kit-0.1.14 lib/grpc_kit/protobuffer.rb
grpc_kit-0.1.13 lib/grpc_kit/protobuffer.rb
grpc_kit-0.1.12 lib/grpc_kit/protobuffer.rb
grpc_kit-0.1.11 lib/grpc_kit/protobuffer.rb
grpc_kit-0.1.10 lib/grpc_kit/protobuffer.rb
grpc_kit-0.1.9 lib/grpc_kit/protobuffer.rb