Class: Pepito::Handlers::Help
- Inherits:
-
Pepito::Handler
- Object
- Pepito::Handler
- Pepito::Handlers::Help
- Defined in:
- lib/pepito/handlers/help.rb
Overview
Handler to give an help command.
Instance Attribute Summary
Attributes inherited from Pepito::Handler
Instance Method Summary collapse
-
#chat_help(_source, _match_data) ⇒ Array<String>
Return the help strings.
-
#run ⇒ void
Run the handler.
Methods inherited from Pepito::Handler
Methods included from Pepito::Handler::ChatRouter
Methods included from Pepito::Handler::HTTPRouter
Constructor Details
This class inherits a constructor from Pepito::Handler
Instance Method Details
#chat_help(_source, _match_data) ⇒ Array<String>
Return the help strings.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pepito/handlers/help.rb', line 17 def chat_help(_source, _match_data) strings = [] @robot.handlers.each do |_, handler| handler.chat_routes.each do |route| next if route.help.nil? strings << help_string(route) end end strings end |
#run ⇒ void
This method returns an undefined value.
Run the handler.
9 10 11 |
# File 'lib/pepito/handlers/help.rb', line 9 def run chat_route(/^help$/i, :chat_help, command: true, help: 'help -> show this screen') end |