123456789_123456789_123456789_123456789_123456789_

Class: Gem::Resolver::IndexSpecification

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Gem::Resolver::Specification
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.

Class Method Summary

Specification - Inherited

.new

Sets default instance variables for the specification.

Instance Attribute Summary

Specification - Inherited

#dependencies

The dependencies of the gem for this specification.

#installable_platform?

Returns true if this specification is installable on this platform.

#name

The name of the gem for this specification.

#platform

The platform this gem works on.

#set

The set this specification came from.

#source

The source for this specification.

#spec
#version

The version of the gem for this specification.

#local?

Instance Method Summary

Specification - Inherited

#full_name

The name and version of the specification.

#install

Installs this specification using the ::Gem::Installer options.

#fetch_development_dependencies

Fetches development dependencies if the source does not provide them by default (see APISpecification).

Constructor Details

.new(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.

[ GitHub ]

  
# File 'lib/rubygems/resolver/index_specification.rb', line 18

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

#dependencies

The dependencies of the gem for this specification

[ GitHub ]

  
# File 'lib/rubygems/resolver/index_specification.rb', line 33

def dependencies
  spec.dependencies
end

#inspect

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rubygems/resolver/index_specification.rb', line 37

def inspect # :nodoc:
  '#<%s %s source %s>' % [self.class, full_name, @source]
end

#pretty_print(q)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rubygems/resolver/index_specification.rb', line 41

def pretty_print q # :nodoc:
  q.group 2, '[Index specification', ']' do
    q.breakable
    q.text full_name

    unless Gem::Platform::RUBY == @platform then
      q.breakable
      q.text @platform.to_s
    end

    q.breakable
    q.text 'source '
    q.pp @source
  end
end

#spec

This method is for internal use only.

Fetches a ::Gem::Specification for this IndexSpecification from the #source.

[ GitHub ]

  
# File 'lib/rubygems/resolver/index_specification.rb', line 60

def spec # :nodoc:
  @spec ||=
    begin
      tuple = Gem::NameTuple.new @name, @version, @platform

      @source.fetch_spec tuple
    end
end