End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Gem::Command.new
new(command, summary=nil, defaults={})
lib/rubygems/command.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/rubygems/command.rb, line 121
def initialize(command, summary=nil, defaults={})
@command = command
@summary = summary
@program_name = "gem #{command}"
@defaults = defaults
@options = defaults.dup
@option_groups = Hash.new {|h,k| h[k] = [] }
@deprecated_options = { command => {} }
@parser = nil
@when_invoked = nil
end
Initializes a generic gem command named command. summary is a short description displayed in ‘gem help commands`. defaults are the default options. Defaults should be mirrored in defaults_str, unless there are none.
When defining a new command subclass, use add_option to add command-line switches.
Unhandled arguments (gem names, files, etc.) are left in options[:args].
See also
.extra_args=
.specific_extra_args
.extra_args
.specific_extra_args_hash
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1