class ProxyEndpoint
An endpoint suitable for proxing requests, typically via a unix pipe.
Definitions
def initialize(endpoint, **options)
Initialize the proxy endpoint.
Signature
-
parameter
endpoint
::IO::Endpoint::Generic
The endpoint which will be used for connecting/binding.
Implementation
def initialize(endpoint, **options)
super(**options)
@endpoint = endpoint
end
attr :endpoint
The actual endpoint for I/O.
Signature
-
attribute
::IO::Endpoint::Generic
def protocol
The protocol to use for this connection.
Signature
-
returns
Async::HTTP::Protocol
A specific protocol, e.g.
Async::HTTP::Protocol::HTTP1
Implementation
def protocol
@options[:protocol]
end
def scheme
The scheme to use for this endpoint.
e.g. "http"
.
Signature
-
returns
String
Implementation
def scheme
@options[:scheme]
end
def connect(&block)
Connect to the endpoint.
Implementation
def connect(&block)
@endpoint.connect(&block)
end
def bind(&block)
Bind to the endpoint.
Implementation
def bind(&block)
@endpoint.bind(&block)
end
def each
Enumerate the endpoint. If the endpoint has multiple underlying endpoints, this will enumerate them individually.
Signature
-
yields
{|endpoint| ...}
-
parameter
endpoint
ProxyEndpoint
-
parameter
Implementation
def each
return to_enum unless block_given?
@endpoint.each do |endpoint|
yield self.class.new(endpoint, **@options)
end
end
def self.unix(path, **options)
Create a proxy unix endpoint with the specific path.
Signature
-
returns
ProxyEndpoint
Implementation
def self.unix(path, **options)
self.new(::IO::Endpoint.unix(path), **options)
end