Class: Coolio::UNIXSocket

Inherits:
Socket show all
Defined in:
lib/cool.io/socket.rb

Constant Summary

Constants inherited from IO

IO::INPUT_SIZE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Socket

#attach, #on_connect, #on_connect_failed

Methods inherited from IO

#attach, #attached?, #close, #closed?, #detach, #disable, #enable, #enabled?, #evloop, #on_close, #on_read, #on_write_complete, #write

Methods included from Meta

#event_callback, #watcher_delegate

Constructor Details

#initialize(socket) ⇒ UNIXSocket

Returns a new instance of UNIXSocket.

Raises:

  • (ArgumentError)


226
227
228
229
230
231
# File 'lib/cool.io/socket.rb', line 226

def initialize(socket)
  raise ArgumentError, "socket must be a UNIXSocket" unless socket.is_a? ::UNIXSocket

  super
  @address_family, @path = socket.peeraddr
end

Instance Attribute Details

#address_familyObject (readonly)

Returns the value of attribute address_family.



219
220
221
# File 'lib/cool.io/socket.rb', line 219

def address_family
  @address_family
end

#pathObject (readonly)

Returns the value of attribute path.



219
220
221
# File 'lib/cool.io/socket.rb', line 219

def path
  @path
end

Class Method Details

.connect(path, *args) ⇒ Object

Connect to the given UNIX domain socket



222
223
224
# File 'lib/cool.io/socket.rb', line 222

def self.connect(path, *args)
  new(::UNIXSocket.new(path), *args)
end