Class: Falcon::ProxyEndpoint
- Inherits:
-
Async::IO::Endpoint
- Object
- Async::IO::Endpoint
- Falcon::ProxyEndpoint
- Defined in:
- lib/falcon/proxy_endpoint.rb
Overview
An endpoint suitable for proxing requests, typically via a unix pipe.
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
The actual endpoint for I/O.
Class Method Summary collapse
-
.unix(path, **options) ⇒ Object
Create a proxy unix endpoint with the specific path.
Instance Method Summary collapse
-
#authority ⇒ Object
The authority to use for this endpoint.
-
#bind(&block) ⇒ Object
Bind to the endpoint.
-
#connect(&block) ⇒ Object
Connect to the endpoint.
-
#each ⇒ Object
Enumerate the endpoint.
-
#initialize(endpoint, **options) ⇒ ProxyEndpoint
constructor
Initialize the proxy endpoint.
-
#protocol ⇒ Object
The protocol to use for this connection.
-
#scheme ⇒ Object
The scheme to use for this endpoint.
- #to_s ⇒ Object
Constructor Details
#initialize(endpoint, **options) ⇒ ProxyEndpoint
Initialize the proxy endpoint.
30 31 32 33 34 |
# File 'lib/falcon/proxy_endpoint.rb', line 30 def initialize(endpoint, **) super(**) @endpoint = endpoint end |
Instance Attribute Details
#endpoint ⇒ Object
The actual endpoint for I/O.
42 43 44 |
# File 'lib/falcon/proxy_endpoint.rb', line 42 def endpoint @endpoint end |
Class Method Details
.unix(path, **options) ⇒ Object
Create a proxy unix endpoint with the specific path.
88 89 90 |
# File 'lib/falcon/proxy_endpoint.rb', line 88 def self.unix(path, **) self.new(::Async::IO::Endpoint.unix(path), **) end |
Instance Method Details
#authority ⇒ Object
The authority to use for this endpoint. e.g. ‘“myapp.com”`.
60 61 62 |
# File 'lib/falcon/proxy_endpoint.rb', line 60 def @options[:authority] end |
#bind(&block) ⇒ Object
Bind to the endpoint.
70 71 72 |
# File 'lib/falcon/proxy_endpoint.rb', line 70 def bind(&block) @endpoint.bind(&block) end |
#connect(&block) ⇒ Object
Connect to the endpoint.
65 66 67 |
# File 'lib/falcon/proxy_endpoint.rb', line 65 def connect(&block) @endpoint.connect(&block) end |
#each ⇒ Object
Enumerate the endpoint. If the endpoint has multiple underlying endpoints, this will enumerate them individually.
78 79 80 81 82 83 84 |
# File 'lib/falcon/proxy_endpoint.rb', line 78 def each return to_enum unless block_given? @endpoint.each do |endpoint| yield self.class.new(endpoint, **@options) end end |
#protocol ⇒ Object
The protocol to use for this connection.
46 47 48 |
# File 'lib/falcon/proxy_endpoint.rb', line 46 def protocol @options[:protocol] end |
#scheme ⇒ Object
The scheme to use for this endpoint. e.g. ‘“http”`.
53 54 55 |
# File 'lib/falcon/proxy_endpoint.rb', line 53 def scheme @options[:scheme] end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/falcon/proxy_endpoint.rb', line 36 def to_s "\#<#{self.class} endpoint=#{@endpoint}>" end |