class Async::IO::SocketEndpoint

This class doesn't exert ownership over the specified socket, wraps a native ::IO.

Attributes

socket[R]

Public Class Methods

new(socket, **options) click to toggle source
Calls superclass method Async::IO::Endpoint::new
# File lib/async/io/socket_endpoint.rb, line 29
def initialize(socket, **options)
        super(**options)
        
        # This socket should already be in the required state.
        @socket = Async::IO.try_convert(socket)
end

Public Instance Methods

bind() { |socket| ... } click to toggle source
# File lib/async/io/socket_endpoint.rb, line 42
def bind(&block)
        if block_given?
                begin
                        yield @socket
                ensure
                        @socket.reactor = nil
                end
        else
                return @socket
        end
end
connect() { |socket| ... } click to toggle source
# File lib/async/io/socket_endpoint.rb, line 54
def connect(&block)
        if block_given?
                begin
                        yield @socket
                ensure
                        @socket.reactor = nil
                end
        else
                return @socket
        end
end
to_s() click to toggle source
# File lib/async/io/socket_endpoint.rb, line 36
def to_s
        "\#<#{self.class} #{@socket.inspect}>"
end