aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/dependency_resolver/activation_request.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/dependency_resolver/activation_request.rb')
-rw-r--r--lib/rubygems/dependency_resolver/activation_request.rb49
1 files changed, 39 insertions, 10 deletions
diff --git a/lib/rubygems/dependency_resolver/activation_request.rb b/lib/rubygems/dependency_resolver/activation_request.rb
index 25af6378ac..c5d1e24d85 100644
--- a/lib/rubygems/dependency_resolver/activation_request.rb
+++ b/lib/rubygems/dependency_resolver/activation_request.rb
@@ -47,11 +47,21 @@ class Gem::DependencyResolver::ActivationRequest
end
def inspect # :nodoc:
- others_possible = nil
- others_possible = ' (others possible)' if @others_possible
+ others =
+ case @others_possible
+ when true then # TODO remove at RubyGems 3
+ ' (others possible)'
+ when false then # TODO remove at RubyGems 3
+ nil
+ else
+ unless @others_possible.empty? then
+ others = @others_possible.map { |s| s.full_name }
+ " (others possible: #{others.join ', '})"
+ end
+ end
'#<%s for %p from %s%s>' % [
- self.class, @spec, @request, others_possible
+ self.class, @spec, @request, others
]
end
@@ -59,10 +69,15 @@ class Gem::DependencyResolver::ActivationRequest
# Indicates if the requested gem has already been installed.
def installed?
- this_spec = full_spec
+ case @spec
+ when Gem::DependencyResolver::VendorSpecification then
+ true
+ else
+ this_spec = full_spec
- Gem::Specification.any? do |s|
- s == this_spec
+ Gem::Specification.any? do |s|
+ s == this_spec
+ end
end
end
@@ -75,7 +90,12 @@ class Gem::DependencyResolver::ActivationRequest
# requests for the same Dependency request.
def others_possible?
- @others_possible
+ case @others_possible
+ when true, false then
+ @others_possible
+ else
+ not @others_possible.empty?
+ end
end
##
@@ -95,9 +115,18 @@ class Gem::DependencyResolver::ActivationRequest
q.text ' for '
q.pp @request
-
- q.breakable
- q.text ' (other possible)' if @others_possible
+ case @others_possible
+ when false then
+ when true then
+ q.breakable
+ q.text 'others possible'
+ else
+ unless @others_possible.empty? then
+ q.breakable
+ q.text 'others '
+ q.pp @others_possible.map { |s| s.full_name }
+ end
+ end
end
end