class Daneel::Scripts::Help

Public Instance Methods

help() click to toggle source
# File lib/daneel/scripts/help.rb, line 16
def help
  {"help" => "show this help summary"}
end
receive(room, message, user) click to toggle source
# File lib/daneel/scripts/help.rb, line 7
def receive(room, message, user)
  case message.command
  when /help$/
    col = helps.keys.map(&:length).max + 2
    room.say helps.map{|k,v| "%-#{col}s %s" % [k,v] }.sort.join("\n")
    message.done!
  end
end

Private Instance Methods

helps() click to toggle source
# File lib/daneel/scripts/help.rb, line 22
def helps
  @helps ||= begin
    helps = {}
    robot.scripts.each do |script|
      helps.merge!(script.help)
    end
    logger.debug "Found helps: #{helps.inspect}"
    helps
  end
end