class Fyrehose::AbstractClient

Constants

TIMEOUT

Public Class Methods

new(host, port, opts = {}) click to toggle source
# File lib/fyrehose/abstract_client.rb, line 5
def initialize(host, port, opts = {})
  @host = host
  @port = port
  @opts = opts

  @timeout = if opts[:timeout]
    opts[:timeout].to_f
  else
    TIMEOUT
  end
end

Public Instance Methods

deliver(channel, data) click to toggle source
# File lib/fyrehose/abstract_client.rb, line 17
def deliver(channel, data)
  channel = channel.to_s
  data = data.to_s

  if channel.include?(" ")
    raise Fyrehose::Error.new("channel names must not include whitespace")
  end

  txid = Fyrehose.next_txid
  send_data("##{txid} @#{channel} *#{data.size} #{data}\n")
end

Private Instance Methods

send_data(data) click to toggle source
# File lib/fyrehose/abstract_client.rb, line 31
def send_data(data)
  raise "implement me"
end