Class: Jobby::Client
- Inherits:
-
Object
- Object
- Jobby::Client
- Defined in:
- lib/client.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(socket_path, &block) ⇒ Client
constructor
Creates a new client.
- #send(message = "") ⇒ Object
Constructor Details
#initialize(socket_path, &block) ⇒ Client
Creates a new client. Passing a block here is a shortcut for calling send and then close.
22 23 24 25 26 27 28 |
# File 'lib/client.rb', line 22 def initialize(socket_path, &block) @socket = UNIXSocket.open(socket_path) if block_given? yield(self) close end end |
Instance Method Details
#close ⇒ Object
34 35 36 |
# File 'lib/client.rb', line 34 def close @socket.close end |
#send(message = "") ⇒ Object
30 31 32 |
# File 'lib/client.rb', line 30 def send( = "") @socket.send(, 0) end |