Skip to content

Commit 9aeec87

Browse files
Added document for Gem::Uninstaller (#8904)
* Added document for Gem::Uninstaller * Apply suggestion from @deivid-rodriguez Co-authored-by: David Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com> --------- Co-authored-by: David Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com>
1 parent 94f6f83 commit 9aeec87

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

lib/rubygems/uninstaller.rb

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,25 @@ class Gem::Uninstaller
4242
attr_reader :spec
4343

4444
##
45-
# Constructs an uninstaller that will uninstall +gem+
45+
# Constructs an uninstaller that will uninstall gem named +gem+.
46+
# +options+ is a Hash with the following keys:
47+
#
48+
# :version:: Version requirement for the gem to uninstall. If not specified,
49+
# uses Gem::Requirement.default.
50+
# :install_dir:: The directory where the gem is installed. If not specified,
51+
# uses Gem.dir.
52+
# :executables:: Whether executables should be removed without confirmation or not. If nil, asks the user explicitly.
53+
# :all:: If more than one version matches the requirement, whether to forcefully remove all matching versions or ask the user to select specific matching versions that should be removed.
54+
# :ignore:: Ignore broken dependency checks when uninstalling.
55+
# :bin_dir:: Directory containing executables to remove. If not specified,
56+
# uses Gem.bindir.
57+
# :format_executable:: In order to find executables to be removed, format executable names using Gem::Installer.exec_format.
58+
# :abort_on_dependent:: Directly abort uninstallation if dependencies would be broken, rather than asking the user for confirmation.
59+
# :check_dev:: When checking if uninstalling gem would leave broken dependencies around, also consider development dependencies.
60+
# :force:: Set both :all and :ignore to true for forced uninstallation.
61+
# :user_install:: Uninstall from user gem directory instead of system directory.
4662

4763
def initialize(gem, options = {})
48-
# TODO: document the valid options
4964
@gem = gem
5065
@version = options[:version] || Gem::Requirement.default
5166
@install_dir = options[:install_dir]
@@ -57,10 +72,6 @@ def initialize(gem, options = {})
5772
@bin_dir = options[:bin_dir]
5873
@format_executable = options[:format_executable]
5974
@abort_on_dependent = options[:abort_on_dependent]
60-
61-
# Indicate if development dependencies should be checked when
62-
# uninstalling. (default: false)
63-
#
6475
@check_dev = options[:check_dev]
6576

6677
if options[:force]

0 commit comments

Comments
 (0)