diff options
Diffstat (limited to 'lib/rubygems/resolver/api_specification.rb')
| -rw-r--r-- | lib/rubygems/resolver/api_specification.rb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/rubygems/resolver/api_specification.rb b/lib/rubygems/resolver/api_specification.rb index 589ea1ba61..ccfd6fe084 100644 --- a/lib/rubygems/resolver/api_specification.rb +++ b/lib/rubygems/resolver/api_specification.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true + ## -# Represents a specification retrieved via the rubygems.org API. +# Represents a specification retrieved via the Compact Index API. # # This is used to avoid loading the full Specification object when all we need # is the name, version, and dependencies. @@ -18,10 +19,10 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification end ## - # Creates an APISpecification for the given +set+ from the rubygems.org + # Creates an APISpecification for the given +set+ from the Compact Index API # +api_data+. # - # See https://guides.rubygems.org/rubygems-org-api/#misc_methods for the + # See https://guides.rubygems.org/rubygems-org-compact-index-api for the # format of the +api_data+. def initialize(set, api_data) @@ -35,19 +36,20 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification @dependencies = api_data[:dependencies].map do |name, ver| Gem::Dependency.new(name, ver.split(/\s*,\s*/)).freeze end.freeze + @required_ruby_version = Gem::Requirement.new(api_data.dig(:requirements, :ruby)).freeze + @required_rubygems_version = Gem::Requirement.new(api_data.dig(:requirements, :rubygems)).freeze end def ==(other) # :nodoc: - self.class === other and - @set == other.set and - @name == other.name and - @version == other.version and - @platform == other.platform and - @dependencies == other.dependencies + self.class === other && + @set == other.set && + @name == other.name && + @version == other.version && + @platform == other.platform end def hash - @set.hash ^ @name.hash ^ @version.hash ^ @platform.hash ^ @dependencies.hash + @set.hash ^ @name.hash ^ @version.hash ^ @platform.hash end def fetch_development_dependencies # :nodoc: @@ -61,7 +63,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification end def pretty_print(q) # :nodoc: - q.group 2, '[APISpecification', ']' do + q.group 2, "[APISpecification", "]" do q.breakable q.text "name: #{name}" @@ -72,7 +74,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification q.text "platform: #{platform}" q.breakable - q.text 'dependencies:' + q.text "dependencies:" q.breakable q.pp @dependencies |
