Class: Gem::Resolver::IndexSpecification
- Inherits:
-
Specification
- Object
- Specification
- Gem::Resolver::IndexSpecification
- Defined in:
- lib/rubygems/resolver/index_specification.rb
Overview
Represents a possible Specification object returned from IndexSet. Used to delay needed to download full Specification objects when only the name
and version
are needed.
Instance Attribute Summary
Attributes inherited from Specification
#name, #platform, #set, #source, #version
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#dependencies ⇒ Object
The dependencies of the gem for this specification.
- #hash ⇒ Object
-
#initialize(set, name, version, source, platform) ⇒ IndexSpecification
constructor
An IndexSpecification is created from the index format described in ‘gem help generate_index`.
-
#inspect ⇒ Object
:nodoc:.
-
#pretty_print(q) ⇒ Object
:nodoc:.
-
#required_ruby_version ⇒ Object
The required_ruby_version constraint for this specification.
-
#required_rubygems_version ⇒ Object
The required_rubygems_version constraint for this specification.
-
#spec ⇒ Object
Fetches a Gem::Specification for this IndexSpecification from the #source.
Methods inherited from Specification
#download, #fetch_development_dependencies, #full_name, #install, #installable_platform?, #local?
Constructor Details
#initialize(set, name, version, source, platform) ⇒ IndexSpecification
An IndexSpecification is created from the index format described in ‘gem help generate_index`.
The set
contains other specifications for this (URL) source
.
The name
, version
and platform
are the name, version and platform of the gem.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rubygems/resolver/index_specification.rb', line 17 def initialize(set, name, version, source, platform) super() @set = set @name = name @version = version @source = source @platform = platform.to_s @spec = nil end |
Instance Method Details
#==(other) ⇒ Object
57 58 59 60 61 62 |
# File 'lib/rubygems/resolver/index_specification.rb', line 57 def ==(other) self.class === other && @name == other.name && @version == other.version && @platform == other.platform end |
#dependencies ⇒ Object
The dependencies of the gem for this specification
32 33 34 |
# File 'lib/rubygems/resolver/index_specification.rb', line 32 def dependencies spec.dependencies end |
#hash ⇒ Object
64 65 66 |
# File 'lib/rubygems/resolver/index_specification.rb', line 64 def hash @name.hash ^ @version.hash ^ @platform.hash end |
#inspect ⇒ Object
:nodoc:
68 69 70 |
# File 'lib/rubygems/resolver/index_specification.rb', line 68 def inspect # :nodoc: '#<%s %s source %s>' % [self.class, full_name, @source] end |
#pretty_print(q) ⇒ Object
:nodoc:
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rubygems/resolver/index_specification.rb', line 72 def pretty_print(q) # :nodoc: q.group 2, '[Index specification', ']' do q.breakable q.text full_name unless Gem::Platform::RUBY == @platform q.breakable q.text @platform.to_s end q.breakable q.text 'source ' q.pp @source end end |
#required_ruby_version ⇒ Object
The required_ruby_version constraint for this specification
A fallback is included because when generated, some marshalled specs have it set to nil
.
42 43 44 |
# File 'lib/rubygems/resolver/index_specification.rb', line 42 def required_ruby_version spec.required_ruby_version || Gem::Requirement.default end |
#required_rubygems_version ⇒ Object
The required_rubygems_version constraint for this specification
A fallback is included because the original version of the specification API didn’t include that field, so some marshalled specs in the index have it set to nil
.
53 54 55 |
# File 'lib/rubygems/resolver/index_specification.rb', line 53 def required_rubygems_version spec.required_rubygems_version || Gem::Requirement.default end |