Async::HTTPSourceAsyncHTTPProtocolConfigured

class Configured

A protocol wrapper that forwards pre-configured options to client and server creation.

Definitions

def initialize(protocol, **options)

Initialize with a protocol and options.

Signature

parameter protocol Protocol

The underlying protocol to configure.

parameter options Hash

Options to forward to client and server creation.

Implementation

def initialize(protocol, **options)
	@protocol = protocol
	@options = options
end

attr :protocol

Signature

attribute Protocol

The underlying protocol.

attr :options

Signature

attribute Hash

The options to pass to the protocol.

def client(peer, **options)

Create a client connection using the configured protocol options.

Signature

parameter peer IO

The peer to communicate with.

parameter options Hash

Additional options merged with the configured defaults.

Implementation

def client(peer, **options)
	options = @options.merge(options)
	@protocol.client(peer, **options)
end

def server(peer, **options)

Create a server connection using the configured protocol options.

Signature

parameter peer IO

The peer to communicate with.

parameter options Hash

Additional options merged with the configured defaults.

Implementation

def server(peer, **options)
	options = @options.merge(options)
	@protocol.server(peer, **options)
end

def names

Signature

returns Array(String)

The protocol names from the underlying protocol.

Implementation

def names
	@protocol.names
end