Class: Async::IO::AddressEndpoint

Inherits:
Endpoint
  • Object
show all
Defined in:
lib/async/io/endpoint.rb

Overview

This class will open and close the socket automatically.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Endpoint

#accept, #each, each, parse, ssl, tcp, try_convert, udp, unix

Constructor Details

#initialize(address, **options) ⇒ AddressEndpoint

Returns a new instance of AddressEndpoint.



132
133
134
135
# File 'lib/async/io/endpoint.rb', line 132

def initialize(address, **options)
  @address = address
  @options = options
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



137
138
139
# File 'lib/async/io/endpoint.rb', line 137

def address
  @address
end

#optionsObject (readonly)

Returns the value of attribute options.



138
139
140
# File 'lib/async/io/endpoint.rb', line 138

def options
  @options
end

Instance Method Details

#bind(&block) ⇒ Object



140
141
142
# File 'lib/async/io/endpoint.rb', line 140

def bind(&block)
  Socket.bind(@address, **@options, &block)
end

#connect(&block) ⇒ Object



144
145
146
# File 'lib/async/io/endpoint.rb', line 144

def connect(&block)
  Socket.connect(@address, **@options, &block)
end