class Lita::Handlers::Whats

Public Instance Methods

whats(response) click to toggle source
# File lib/lita/handlers/whats.rb, line 9
def whats(response)
  hostname = response.matches[0][0]
  whats_cmd = "whats -q -j #{hostname}"
  output = `#{whats_cmd}`
  message = ""
  JSON.parse(output).each_pair do |k,v|
    message = message + "*#{k}*:  #{v}\n"
  end
  response.reply message
end