Class: FireAndForget::Client
- Inherits:
-
Object
- Object
- FireAndForget::Client
- Defined in:
- lib/fire_and_forget/client.rb
Class Method Summary collapse
Class Method Details
.open_connection ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fire_and_forget/client.rb', line 13 def open_connection connection = result = nil begin connection = UNIXSocket.open(FireAndForget.socket) yield(connection) connection.flush connection.close_write result = connection.read ensure connection.close if connection rescue nil end result end |
.run(cmd) ⇒ Object
7 8 9 10 11 |
# File 'lib/fire_and_forget/client.rb', line 7 def run(cmd) result = open_connection do |connection| connection.send(cmd.dump, 0) end end |