Class: Async::IO::AddressEndpoint
- Defined in:
- lib/async/io/endpoint.rb
Overview
This class will open and close the socket automatically.
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #bind(&block) ⇒ Object
- #connect(&block) ⇒ Object
-
#initialize(address, **options) ⇒ AddressEndpoint
constructor
A new instance of AddressEndpoint.
- #to_s ⇒ Object
Methods inherited from Endpoint
#accept, each, #each, #hostname, parse, ssl, tcp, try_convert, udp, unix
Constructor Details
#initialize(address, **options) ⇒ AddressEndpoint
Returns a new instance of AddressEndpoint.
151 152 153 154 155 156 |
# File 'lib/async/io/endpoint.rb', line 151 def initialize(address, **) super(**) @address = address @options = end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
162 163 164 |
# File 'lib/async/io/endpoint.rb', line 162 def address @address end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
163 164 165 |
# File 'lib/async/io/endpoint.rb', line 163 def @options end |
Instance Method Details
#bind(&block) ⇒ Object
165 166 167 |
# File 'lib/async/io/endpoint.rb', line 165 def bind(&block) Socket.bind(@address, **@options, &block) end |
#connect(&block) ⇒ Object
169 170 171 |
# File 'lib/async/io/endpoint.rb', line 169 def connect(&block) Socket.connect(@address, **@options, &block) end |
#to_s ⇒ Object
158 159 160 |
# File 'lib/async/io/endpoint.rb', line 158 def to_s "\#<#{self.class} #{@address.inspect}>" end |