Sha256: 2bca808b82ace59597c1f3bd0e6dc9323831bbe73493fc6a33d3d0d3b6af466d
Contents?: true
Size: 609 Bytes
Versions: 3
Compression:
Stored size: 609 Bytes
Contents
require 'socket' module FireAndForget class Client class << self def run(cmd) result = open_connection do |connection| connection.send(cmd.dump, 0) end end def open_connection connection = result = nil begin connection = TCPSocket.open(FireAndForget.bind_address, FireAndForget.port) yield(connection) connection.flush connection.close_write result = connection.read ensure connection.close if connection rescue nil end result end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fire_and_forget-0.1.2 | lib/fire_and_forget/client.rb |
fire_and_forget-0.1.1 | lib/fire_and_forget/client.rb |
fire_and_forget-0.1.0 | lib/fire_and_forget/client.rb |