Class: Falcon::ProxyEndpoint

Inherits:
Async::IO::Endpoint
  • Object
show all
Defined in:
lib/falcon/proxy_endpoint.rb

Overview

An endpoint suitable for proxing requests, typically via a unix pipe.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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, **options)
	super(**options)
	
	@endpoint = endpoint
end

Instance Attribute Details

#endpointObject

The actual endpoint for I/O.



25
26
27
# File 'lib/falcon/proxy_endpoint.rb', line 25

def endpoint
  @endpoint
end

Class Method Details

.unix(path, **options) ⇒ Object

Create a proxy unix endpoint with the specific path.



71
72
73
# File 'lib/falcon/proxy_endpoint.rb', line 71

def self.unix(path, **options)
	self.new(::Async::IO::Endpoint.unix(path), **options)
end

Instance Method Details

#authorityObject

The authority to use for this endpoint. e.g. ‘“myapp.com”`.



43
44
45
# File 'lib/falcon/proxy_endpoint.rb', line 43

def authority
	@options[:authority]
end

#bind(&block) ⇒ Object

Bind to the endpoint.



53
54
55
# File 'lib/falcon/proxy_endpoint.rb', line 53

def bind(&block)
	@endpoint.bind(&block)
end

#connect(&block) ⇒ Object

Connect to the endpoint.



48
49
50
# File 'lib/falcon/proxy_endpoint.rb', line 48

def connect(&block)
	@endpoint.connect(&block)
end

#eachObject

Enumerate the endpoint. If the endpoint has multiple underlying endpoints, this will enumerate them individually.



61
62
63
64
65
66
67
# File 'lib/falcon/proxy_endpoint.rb', line 61

def each
	return to_enum unless block_given?
	
	@endpoint.each do |endpoint|
		yield self.class.new(endpoint, **@options)
	end
end

#protocolObject

The protocol to use for this connection.



29
30
31
# File 'lib/falcon/proxy_endpoint.rb', line 29

def protocol
	@options[:protocol]
end

#schemeObject

The scheme to use for this endpoint. e.g. ‘“http”`.



36
37
38
# File 'lib/falcon/proxy_endpoint.rb', line 36

def scheme
	@options[:scheme]
end

#to_sObject



19
20
21
# File 'lib/falcon/proxy_endpoint.rb', line 19

def to_s
	"\#<#{self.class} endpoint=#{@endpoint}>"
end