Class: Celluloid::IO::UNIXSocket

Inherits:
Stream show all
Defined in:
lib/celluloid/io/unix_socket.rb

Overview

UNIXSocket with combined blocking and evented support

Constant Summary

Constants inherited from Socket

Socket::Constants

Instance Attribute Summary

Attributes inherited from Stream

#sync

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Stream

#<<, #close, #each, #each_byte, #eof?, #flush, #getc, #gets, #print, #printf, #puts, #read, #readchar, #readline, #readlines, #readpartial, #sysread, #syswrite, #ungetc, #wait_readable, #wait_writable, #write

Methods inherited from Socket

new, #to_io, try_convert

Constructor Details

#initialize(socket_path, &block) ⇒ UNIXSocket

Open a UNIX connection.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/celluloid/io/unix_socket.rb', line 20

def initialize(socket_path, &block)
  # Allow users to pass in a Ruby UNIXSocket directly
  if socket_path.is_a? ::UNIXSocket
    super(socket_path)
    return
  end

  # FIXME: not doing non-blocking connect
  if block
    super ::UNIXSocket.open(socket_path, &block)
  else
    super ::UNIXSocket.new(socket_path)
  end
end

Class Method Details

.from_ruby_socket(ruby_socket) ⇒ Object

Deprecated.

use .new instead

Convert a Ruby UNIXSocket into a Celluloid::IO::UNIXSocket DEPRECATED: to be removed in a future release



15
16
17
# File 'lib/celluloid/io/unix_socket.rb', line 15

def self.from_ruby_socket(ruby_socket)
  new(ruby_socket)
end

.open(socket_path, &block) ⇒ Object

Open a UNIX connection.



8
9
10
# File 'lib/celluloid/io/unix_socket.rb', line 8

def self.open(socket_path, &block)
  new(socket_path, &block)
end