Class: Thrift::HeaderProtocolFactory

Inherits:
BaseProtocolFactory show all
Defined in:
lib/thrift/protocol/header_protocol.rb

Overview

Factory for creating HeaderProtocol instances

Instance Method Summary collapse

Constructor Details

#initialize(allowed_client_types = nil, default_protocol = HeaderSubprotocolID::BINARY) ⇒ HeaderProtocolFactory

Creates a new HeaderProtocolFactory.

Parameters:

  • allowed_client_types (Array<Integer>) (defaults to: nil)

    Allowed client types for auto-detection

  • default_protocol (Integer) (defaults to: HeaderSubprotocolID::BINARY)

    Default protocol ID (BINARY or COMPACT)



307
308
309
310
# File 'lib/thrift/protocol/header_protocol.rb', line 307

def initialize(allowed_client_types = nil, default_protocol = HeaderSubprotocolID::BINARY)
  @allowed_client_types = allowed_client_types
  @default_protocol = default_protocol
end

Instance Method Details

#get_protocol(trans) ⇒ Object



312
313
314
# File 'lib/thrift/protocol/header_protocol.rb', line 312

def get_protocol(trans)
  HeaderProtocol.new(trans, @allowed_client_types, @default_protocol)
end

#to_sObject



316
317
318
# File 'lib/thrift/protocol/header_protocol.rb', line 316

def to_s
  "header"
end