Sha256: 27b024024d8284020ba74bc460beb459ce1825a647e557041f56cfd41bd3e4b5

Contents?: true

Size: 723 Bytes

Versions: 14

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

module GrpcKit
  class Codec
    # @param marshal [Class, GrpcKit::Grpc::Stream]
    # @param unmarshal [Class, GrpcKit::Grpc::Stream]
    # @param marshal_method [Symbol]
    # @param unmarshal_method [Symbol]
    def initialize(marshal:, unmarshal:, marshal_method:, unmarshal_method:)
      @marshal = marshal
      @unmarshal = unmarshal
      @marshal_method = marshal_method
      @unmarshal_method = unmarshal_method
    end

    # @param data [String]
    # @return [String]
    def encode(data)
      @marshal.send(@marshal_method, data)
    end

    # @param data [String]
    # @return [String]
    def decode(data)
      @unmarshal.send(@unmarshal_method, data)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
grpc_kit-0.5.1 lib/grpc_kit/codec.rb
grpc_kit-0.5.0 lib/grpc_kit/codec.rb
grpc_kit-0.4.0 lib/grpc_kit/codec.rb
grpc_kit-0.3.9 lib/grpc_kit/codec.rb
grpc_kit-0.3.8 lib/grpc_kit/codec.rb
grpc_kit-0.3.7 lib/grpc_kit/codec.rb
grpc_kit-0.3.6 lib/grpc_kit/codec.rb
grpc_kit-0.3.5 lib/grpc_kit/codec.rb
grpc_kit-0.3.4 lib/grpc_kit/codec.rb
grpc_kit-0.3.3 lib/grpc_kit/codec.rb
grpc_kit-0.3.2 lib/grpc_kit/codec.rb
grpc_kit-0.3.1 lib/grpc_kit/codec.rb
grpc_kit-0.3.0 lib/grpc_kit/codec.rb
grpc_kit-0.2.1 lib/grpc_kit/codec.rb