Class: Falcon::ProxyEndpoint
- Inherits:
-
IO::Endpoint::Generic
- Object
- IO::Endpoint::Generic
- 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
readonly
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
Generate a string representation of the proxy endpoint.
Constructor Details
#initialize(endpoint, **options) ⇒ ProxyEndpoint
Initialize the proxy endpoint.
13 14 15 16 17 |
# File 'lib/falcon/proxy_endpoint.rb', line 13 def initialize(endpoint, **) super(**) @endpoint = endpoint end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
The actual endpoint for I/O.
27 28 29 |
# File 'lib/falcon/proxy_endpoint.rb', line 27 def endpoint @endpoint end |
Class Method Details
.unix(path, **options) ⇒ Object
Create a proxy unix endpoint with the specific path.
73 74 75 |
# File 'lib/falcon/proxy_endpoint.rb', line 73 def self.unix(path, **) self.new(::IO::Endpoint.unix(path), **) end |
Instance Method Details
#authority ⇒ Object
The authority to use for this endpoint. e.g. ‘“myapp.com”`.
45 46 47 |
# File 'lib/falcon/proxy_endpoint.rb', line 45 def @options[:authority] end |
#bind(&block) ⇒ Object
Bind to the endpoint.
55 56 57 |
# File 'lib/falcon/proxy_endpoint.rb', line 55 def bind(&block) @endpoint.bind(&block) end |
#connect(&block) ⇒ Object
Connect to the endpoint.
50 51 52 |
# File 'lib/falcon/proxy_endpoint.rb', line 50 def connect(&block) @endpoint.connect(&block) end |
#each ⇒ Object
Enumerate the endpoint. If the endpoint has multiple underlying endpoints, this will enumerate them individually.
63 64 65 66 67 68 69 |
# File 'lib/falcon/proxy_endpoint.rb', line 63 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.
31 32 33 |
# File 'lib/falcon/proxy_endpoint.rb', line 31 def protocol @options[:protocol] end |
#scheme ⇒ Object
The scheme to use for this endpoint. e.g. ‘“http”`.
38 39 40 |
# File 'lib/falcon/proxy_endpoint.rb', line 38 def scheme @options[:scheme] end |
#to_s ⇒ Object
Generate a string representation of the proxy endpoint.
21 22 23 |
# File 'lib/falcon/proxy_endpoint.rb', line 21 def to_s "\#<#{self.class} protocol=#{self.protocol} endpoint=#{@endpoint}>" end |