Class: Rev::UNIXSocket

Inherits:
Socket show all
Defined in:
lib/rev/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, #on_resolve_failed

Methods inherited from IO

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

Methods included from Meta

#event_callback, #watcher_delegate

Constructor Details

#initialize(socket) ⇒ UNIXSocket

Returns a new instance of UNIXSocket.

Raises:

  • (ArgumentError)


217
218
219
220
221
222
# File 'lib/rev/socket.rb', line 217

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.



210
211
212
# File 'lib/rev/socket.rb', line 210

def address_family
  @address_family
end

#pathObject (readonly)

Returns the value of attribute path.



210
211
212
# File 'lib/rev/socket.rb', line 210

def path
  @path
end

Class Method Details

.connect(path, *args) ⇒ Object

Connect to the given UNIX domain socket



213
214
215
# File 'lib/rev/socket.rb', line 213

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