Class: Gem::Resolver::Specification
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Inherits: | Object |
Defined in: | lib/rubygems/resolver/specification.rb |
Overview
A Specification
contains a subset of the information contained in a ::Gem::Specification. Only the information necessary for dependency resolution in the resolver is included.
Class Method Summary
-
.new ⇒ Specification
constructor
Sets default instance variables for the specification.
Instance Attribute Summary
-
#dependencies
readonly
The dependencies of the gem for this specification.
-
#installable_platform? ⇒ Boolean
readonly
Returns true if this specification is installable on this platform.
-
#name
readonly
The name of the gem for this specification.
-
#platform
readonly
The platform this gem works on.
-
#set
readonly
The set this specification came from.
-
#source
readonly
The source for this specification.
-
#spec
readonly
The ::Gem::Specification for this
Specification
. -
#version
readonly
The version of the gem for this specification.
Instance Method Summary
-
#full_name
The name and version of the specification.
-
#install(options = {}) {|installer| ... }
Installs this specification using the ::Gem::Installer
options
.
Constructor Details
.new ⇒ Specification
Sets default instance variables for the specification.
# File 'lib/rubygems/resolver/specification.rb', line 50
def initialize @dependencies = nil @name = nil @platform = nil @set = nil @source = nil @version = nil end
Instance Attribute Details
#dependencies (readonly)
The dependencies of the gem for this specification
# File 'lib/rubygems/resolver/specification.rb', line 12
attr_reader :dependencies
#installable_platform? ⇒ Boolean
(readonly)
Returns true if this specification is installable on this platform.
#name (readonly)
The name of the gem for this specification
# File 'lib/rubygems/resolver/specification.rb', line 17
attr_reader :name
#platform (readonly)
The platform this gem works on.
# File 'lib/rubygems/resolver/specification.rb', line 22
attr_reader :platform
#set (readonly)
The set this specification came from.
# File 'lib/rubygems/resolver/specification.rb', line 27
attr_reader :set
#source (readonly)
The source for this specification
# File 'lib/rubygems/resolver/specification.rb', line 32
attr_reader :source
#spec (readonly)
The ::Gem::Specification for this Specification
.
Implementers, note that #install updates @spec, so be sure to cache the ::Gem::Specification in @spec when overriding.
# File 'lib/rubygems/resolver/specification.rb', line 40
attr_reader :spec
#version (readonly)
The version of the gem for this specification.
# File 'lib/rubygems/resolver/specification.rb', line 45
attr_reader :version
Instance Method Details
#full_name
The name and version of the specification.
Unlike Specification#full_name, the platform is not included.
# File 'lib/rubygems/resolver/specification.rb', line 71
def full_name "#{@name}-#{@version}" end
#install(options = {}) {|installer| ... }
Installs this specification using the ::Gem::Installer options
. The install method yields a ::Gem::Installer instance, which indicates the gem will be installed, or nil
, which indicates the gem is already installed.
After installation #spec is updated to point to the just-installed specification.
# File 'lib/rubygems/resolver/specification.rb', line 84
def install = {} require 'rubygems/installer' destination = [:install_dir] || Gem.dir Gem.ensure_gem_subdirectories destination gem = source.download spec, destination installer = Gem::Installer.at gem, yield installer if block_given? @spec = installer.install end