summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2025-09-10 16:43:26 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-09-11 11:54:49 +0900
commitd0c7f9ad64a972e91cb3471f808bdba8bf2f89f5 (patch)
treeb726bbd6fb956cf45245bc397dd27fcf3c412944
parent4febdbc418e14fc73c18321301a78b34cbadb510 (diff)
[rubygems/rubygems] Added document for Gem::Uninstaller
(https://github.com/rubygems/rubygems/pull/8904) * Added document for Gem::Uninstaller * Apply suggestion from @deivid-rodriguez Co-authored-by: David Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com> --------- https://github.com/rubygems/rubygems/commit/9aeec8721a Co-authored-by: David Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com>
-rw-r--r--lib/rubygems/uninstaller.rb23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index 991bc6fb95..fe4c3a80cf 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -42,10 +42,25 @@ class Gem::Uninstaller
attr_reader :spec
##
- # Constructs an uninstaller that will uninstall +gem+
+ # Constructs an uninstaller that will uninstall gem named +gem+.
+ # +options+ is a Hash with the following keys:
+ #
+ # :version:: Version requirement for the gem to uninstall. If not specified,
+ # uses Gem::Requirement.default.
+ # :install_dir:: The directory where the gem is installed. If not specified,
+ # uses Gem.dir.
+ # :executables:: Whether executables should be removed without confirmation or not. If nil, asks the user explicitly.
+ # :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.
+ # :ignore:: Ignore broken dependency checks when uninstalling.
+ # :bin_dir:: Directory containing executables to remove. If not specified,
+ # uses Gem.bindir.
+ # :format_executable:: In order to find executables to be removed, format executable names using Gem::Installer.exec_format.
+ # :abort_on_dependent:: Directly abort uninstallation if dependencies would be broken, rather than asking the user for confirmation.
+ # :check_dev:: When checking if uninstalling gem would leave broken dependencies around, also consider development dependencies.
+ # :force:: Set both :all and :ignore to true for forced uninstallation.
+ # :user_install:: Uninstall from user gem directory instead of system directory.
def initialize(gem, options = {})
- # TODO: document the valid options
@gem = gem
@version = options[:version] || Gem::Requirement.default
@install_dir = options[:install_dir]
@@ -57,10 +72,6 @@ class Gem::Uninstaller
@bin_dir = options[:bin_dir]
@format_executable = options[:format_executable]
@abort_on_dependent = options[:abort_on_dependent]
-
- # Indicate if development dependencies should be checked when
- # uninstalling. (default: false)
- #
@check_dev = options[:check_dev]
if options[:force]