Class: Async::HTTP::Protocol::Configured

Inherits:
Object
  • Object
show all
Defined in:
lib/async/http/protocol/configurable.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(protocol, **options) ⇒ Configured

Initialize with a protocol and options.



14
15
16
17
# File 'lib/async/http/protocol/configurable.rb', line 14

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

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



23
24
25
# File 'lib/async/http/protocol/configurable.rb', line 23

def options
  @options
end

#protocolObject (readonly)

Returns the value of attribute protocol.



20
21
22
# File 'lib/async/http/protocol/configurable.rb', line 20

def protocol
  @protocol
end

#The underlying protocol.(underlyingprotocol.) ⇒ Object (readonly)



20
# File 'lib/async/http/protocol/configurable.rb', line 20

attr :protocol

Instance Method Details

#client(peer, **options) ⇒ Object

Create a client connection using the configured protocol options.



28
29
30
31
# File 'lib/async/http/protocol/configurable.rb', line 28

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

#namesObject



42
43
44
# File 'lib/async/http/protocol/configurable.rb', line 42

def names
	@protocol.names
end

#server(peer, **options) ⇒ Object

Create a server connection using the configured protocol options.



36
37
38
39
# File 'lib/async/http/protocol/configurable.rb', line 36

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

#The options to pass to the protocol.=(optionstopasstotheprotocol. = (value)) ⇒ Object



23
# File 'lib/async/http/protocol/configurable.rb', line 23

attr :options