Method: Eye::Client#execute

Defined in:
lib/eye/client.rb

#execute(h = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/eye/client.rb', line 15

def execute(h = {})
  payload = if @type == :old
    Marshal.dump([h[:command], *h[:args]]) # TODO: remove in 1.0
  else
    payload = Marshal.dump(h)
    [SIGN, payload.length].pack('N*') + payload
  end
  timeout = h[:timeout] || Eye::Local.client_timeout
  attempt_command(payload, timeout)
end