Module: CultomePlayer::Plugins::Help
- Included in:
- CultomePlayer::Plugins
- Defined in:
- lib/cultome_player/plugins/help.rb
Instance Method Summary collapse
-
#command_help(cmd) ⇒ Response
Command implementation for action “help”.
-
#description_help ⇒ String
Description of the action help.
- #sintax_help ⇒ Object
-
#usage_help ⇒ String
The usage information of the action.
Instance Method Details
#command_help(cmd) ⇒ Response
Command implementation for action “help”. Shows usage information for the actions of the player if called with an action as parameter and shows a player usage information if called without parameters.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cultome_player/plugins/help.rb', line 11 def command_help(cmd) if cmd.params.empty? success(message: usage_cultome_player) else help = send("usage_#{cmd.params.first.value}") if help.nil? failure("No help is available for '#{cmd.params.first.value}'.") else success(message: help) end end end |
#description_help ⇒ String
Description of the action help.
32 33 34 |
# File 'lib/cultome_player/plugins/help.rb', line 32 def description_help "Provides information for player features." end |
#sintax_help ⇒ Object
24 25 26 |
# File 'lib/cultome_player/plugins/help.rb', line 24 def sintax_help /^literal (literal)$/ end |
#usage_help ⇒ String
Returns The usage information of the action.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cultome_player/plugins/help.rb', line 40 def usage_help return <<-USAGE usage: help [command] Provides usage information for player commands. If called without parameters, shows the player usage. Examples: To see all the commands availables in the player: help To see the usage for play command: help play USAGE end |