Class: Thrift::UNIXSocket
- Inherits:
-
Socket
- Object
- BaseTransport
- Socket
- Thrift::UNIXSocket
- Defined in:
- lib/thrift/transport/unix_socket.rb
Instance Attribute Summary
Attributes inherited from Socket
Instance Method Summary collapse
-
#initialize(path, timeout = nil) ⇒ UNIXSocket
constructor
A new instance of UNIXSocket.
- #open ⇒ Object
- #to_s ⇒ Object
Methods inherited from Socket
Methods inherited from BaseTransport
#close, #flush, #open?, #read, #read_all, #read_byte, #read_into_buffer, #write
Constructor Details
#initialize(path, timeout = nil) ⇒ UNIXSocket
Returns a new instance of UNIXSocket.
25 26 27 28 29 30 |
# File 'lib/thrift/transport/unix_socket.rb', line 25 def initialize(path, timeout=nil) @path = path @timeout = timeout @desc = @path # for read()'s error @handle = nil end |
Instance Method Details
#open ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/thrift/transport/unix_socket.rb', line 32 def open begin @handle = ::UNIXSocket.new(@path) rescue StandardError raise TransportException.new(TransportException::NOT_OPEN, "Could not open UNIX socket at #{@path}") end end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/thrift/transport/unix_socket.rb', line 40 def to_s "domain(#{@path})" end |