class Async::IO::AddressEndpoint

This class will open and close the socket automatically.

Attributes

address[R]

Public Class Methods

new(address, **options) click to toggle source
Calls superclass method
# File lib/async/io/address_endpoint.rb, line 29
def initialize(address, **options)
        super(**options)
        
        @address = address
end

Public Instance Methods

bind(&block) click to toggle source

Bind a socket to the given address. If a block is given, the socket will be automatically closed when the block exits. @yield [Socket] the bound socket @return [Socket] the bound socket

# File lib/async/io/address_endpoint.rb, line 44
def bind(&block)
        Socket.bind(@address, **@options, &block)
end
connect(&block) click to toggle source

Connects a socket to the given address. If a block is given, the socket will be automatically closed when the block exits. @return [Socket] the connected socket

# File lib/async/io/address_endpoint.rb, line 50
def connect(&block)
        Socket.connect(@address, **@options, &block)
end
to_s() click to toggle source
# File lib/async/io/address_endpoint.rb, line 35
def to_s
        "\#<#{self.class} #{@address.inspect}>"
end