class Async::IO::Endpoint
def self.each(specifications, &block)
def self.each(specifications, &block) return to_enum(:each, specifications) unless block_given? specifications.each do |specification| yield try_convert(specification) end end
def self.parse(string, **options)
def self.parse(string, **options) uri = URI.parse(string) self.send(uri.scheme, uri.host, uri.port, **options) end
def self.socket(socket, **options)
def self.socket(socket, **options) SocketEndpoint.new(socket, **options) end
def self.ssl(*args, **options)
def self.ssl(*args, **options) SSLEndpoint.new(self.tcp(*args, **options), **options) end
def self.tcp(*args, **options)
def self.tcp(*args, **options) args[3] = ::Socket::SOCK_STREAM HostEndpoint.new(args, **options) end
def self.try_convert(specification)
def self.try_convert(specification) if specification.is_a? self specification elsif specification.is_a? Array self.send(*specification) elsif specification.is_a? String self.parse(specification) elsif specification.is_a? ::BasicSocket self.socket(specification) elsif specification.is_a? Generic self.new(specification) else raise ArgumentError.new("Not sure how to convert #{specification} to endpoint!") end end
def self.udp(*args, **options)
def self.udp(*args, **options) args[3] = ::Socket::SOCK_DGRAM HostEndpoint.new(args, **options) end
def self.unix(*args, **options)
def self.unix(*args, **options) AddressEndpoint.new(Address.unix(*args), **options) end
def accept(backlog = Socket::SOMAXCONN, &block)
def accept(backlog = Socket::SOMAXCONN, &block) bind do |server| server.listen(backlog) server.accept_each(&block) end end
def each
def each return to_enum unless block_given? yield self end
def hostname
def hostname @options[:hostname] end
def initialize(**options)
def initialize(**options) @options = options end