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