class Gem::Commands::HelpCommand - Documentation for Ruby 4.0
Description: Documentation for the Gem::Commands::HelpCommand class
Keywords: ruby,class,Gem::Commands::HelpCommand

🔍

No recent searches

# class Gem::Commands::HelpCommand

### Public Class Methods

new ()
Source

    # File lib/rubygems/commands/help_command.rb, line 283
    def initialize
      super "help", "Provide help on the 'gem' command"

      @command_manager = Gem::CommandManager.instance
    end

Calls superclass method `Gem::Command::new`

### Public Instance Methods

execute ()
Source

    # File lib/rubygems/commands/help_command.rb, line 293
    def execute
      arg = options[:args][0]

      _, help = SUBCOMMANDS.find do |command,|
        begins? command, arg
      end

      if help
        if Symbol === help
          send help
        else
          say help
        end
        return
      end

      if options[:help]
        show_help

      elsif arg
        show_command_help arg

      else
        say Gem::Command::HELP
      end
    end