Class: Ellen::Handlers::Help

Inherits:
Base
  • Object
show all
Defined in:
lib/ellen/handlers/help.rb

Instance Attribute Summary

Attributes inherited from Base

#robot

Instance Method Summary collapse

Methods inherited from Base

actions, #call, inherited, #initialize, on

Constructor Details

This class inherits a constructor from Ellen::Handlers::Base

Instance Method Details

#help(message) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/ellen/handlers/help.rb', line 6

def help(message)
  lines = Ellen.handlers.map(&:actions).flatten.sort_by(&:all?).map do |action|
    prefix = "@#{robot.name} " unless action.all?
    line = "%-30s - #{action.description}" % "#{prefix}#{action.pattern.inspect}"
    line
  end
  robot.say lines.join("\n")
end