module CultomePlayer::Plugins::Help

Public Instance Methods

command_help(cmd) click to toggle source

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.

@contract Plugin @param cmd [Command] Command information parsed from user input @return [Response] Contains a message to be displayed with the help required.

# 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() click to toggle source

Description of the action help.

@contract Help Plugin. @return [String] The description of the action.

# File lib/cultome_player/plugins/help.rb, line 32
def description_help
   "Provides information for player features."
end
sintax_help() click to toggle source
# File lib/cultome_player/plugins/help.rb, line 24
def sintax_help
   /^literal (literal)$/
end
usage_help() click to toggle source

Usage information of the action help.

@contract Help Plugin. @return [String] The usage information of the action.

# 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