Class: Async::IO::AddressEndpoint
- Defined in:
 - lib/async/io/address_endpoint.rb
 
Overview
This class will open and close the socket automatically.
Direct Known Subclasses
Instance Attribute Summary collapse
- 
  
    
      #address  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute address.
 
Attributes inherited from Endpoint
Instance Method Summary collapse
- 
  
    
      #bind {|Socket| ... } ⇒ Socket 
    
    
  
  
  
  
  
  
  
  
  
    
Bind a socket to the given address.
 - 
  
    
      #connect(&block)  ⇒ Socket 
    
    
  
  
  
  
  
  
  
  
  
    
Connects a socket to the given address.
 - 
  
    
      #initialize(address, **options)  ⇒ AddressEndpoint 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of AddressEndpoint.
 - #to_s ⇒ Object
 
Methods inherited from Endpoint
#accept, #bound, composite, #connected, #each, each, #hostname, #linger, #local_address, parse, #reuse_address, #reuse_port, socket, ssl, tcp, #timeout, try_convert, udp, unix, #with
Constructor Details
#initialize(address, **options) ⇒ AddressEndpoint
Returns a new instance of AddressEndpoint.
      12 13 14 15 16  | 
    
      # File 'lib/async/io/address_endpoint.rb', line 12 def initialize(address, **) super(**) @address = address end  | 
  
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
      22 23 24  | 
    
      # File 'lib/async/io/address_endpoint.rb', line 22 def address @address end  | 
  
Instance Method Details
#bind {|Socket| ... } ⇒ Socket
Bind a socket to the given address. If a block is given, the socket will be automatically closed when the block exits.
      27 28 29  | 
    
      # File 'lib/async/io/address_endpoint.rb', line 27 def bind(&block) Socket.bind(@address, **@options, &block) end  | 
  
#connect(&block) ⇒ Socket
Connects a socket to the given address. If a block is given, the socket will be automatically closed when the block exits.
      33 34 35  | 
    
      # File 'lib/async/io/address_endpoint.rb', line 33 def connect(&block) Socket.connect(@address, **@options, &block) end  | 
  
#to_s ⇒ Object
      18 19 20  | 
    
      # File 'lib/async/io/address_endpoint.rb', line 18 def to_s "\#<#{self.class} #{@address.inspect}>" end  |