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
protocolProtocol The underlying protocol to configure.
-
parameter
optionsHash 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
peerIO The peer to communicate with.
-
parameter
optionsHash 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
peerIO The peer to communicate with.
-
parameter
optionsHash 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