Sha256: 08352a0db43ec9670f83a1e9013d20e792cfdfb4164c961dc86ddfb1cc4dc942
Contents?: true
Size: 574 Bytes
Versions: 4
Compression:
Stored size: 574 Bytes
Contents
require 'socket' require 'timeout' class Eye::Client attr_reader :socket_path def initialize(socket_path) @socket_path = socket_path end def command(cmd, *args) attempt_command(Marshal.dump([cmd, *args])) end def attempt_command(pack) Timeout.timeout(Eye::Local.client_timeout) { send_request(pack) } rescue Timeout::Error, EOFError :timeouted end def send_request(pack) UNIXSocket.open(@socket_path) do |socket| socket.write(pack) data = socket.read Marshal.load(data) rescue :corrupted_data end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
eye-0.8.1 | lib/eye/client.rb |
eye-0.8.celluloid15 | lib/eye/client.rb |
eye-0.8 | lib/eye/client.rb |
eye-0.8.rc | lib/eye/client.rb |