class Nsqrb::Command::Identify

Public Instance Methods

to_line() click to toggle source
# File lib/nsqrb/command/identify.rb, line 4
def to_line
  filtered = params.inject({}) do |hash, key|
    hash[key] = @args[key] if @args[key].nil?
    hash
  end
  payload = JSON.dump(filtered)
  [name, "\n", payload.length, payload].pack('a*a*l>a*')
end

Private Instance Methods

failure_codes() click to toggle source
# File lib/nsqrb/command/identify.rb, line 19
def failure_codes
  %w(E_INVALID E_BAD_BODY)
end
params() click to toggle source
# File lib/nsqrb/command/identify.rb, line 23
def params
  [
    :short_id, :long_id, :feature_negotiation, :heartbeat_interval, :output_buffer_size,
    :output_buffer_timeout, :tls_v1, :snappy, :deflate, :deflate_level, :sample_rate
  ]
end
success_codes() click to toggle source
# File lib/nsqrb/command/identify.rb, line 15
def success_codes
  %w(OK)
end