Class: Gem::Resolver::Specification
- Inherits:
-
Object
- Object
- Gem::Resolver::Specification
- Defined in:
- lib/rubygems/resolver/specification.rb
Overview
A Resolver::Specification contains a subset of the information contained in a Gem::Specification. Only the information necessary for dependency resolution in the resolver is included.
Direct Known Subclasses
APISpecification, IndexSpecification, LockSpecification, SpecSpecification
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
The dependencies of the gem for this specification.
-
#name ⇒ Object
readonly
The name of the gem for this specification.
-
#platform ⇒ Object
readonly
The platform this gem works on.
-
#set ⇒ Object
readonly
The set this specification came from.
-
#source ⇒ Object
readonly
The source for this specification.
-
#version ⇒ Object
readonly
The version of the gem for this specification.
Instance Method Summary collapse
-
#full_name ⇒ Object
The name and version of the specification.
-
#initialize ⇒ Specification
constructor
Sets default instance variables for the specification.
-
#install(options) {|installer| ... } ⇒ Object
Installs this specification using the Gem::Installer
options. -
#installable_platform? ⇒ Boolean
Returns true if this specification is installable on this platform.
Constructor Details
#initialize ⇒ Specification
Sets default instance variables for the specification.
41 42 43 44 45 46 47 48 |
# File 'lib/rubygems/resolver/specification.rb', line 41 def initialize @dependencies = nil @name = nil @platform = nil @set = nil @source = nil @version = nil end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
The dependencies of the gem for this specification
11 12 13 |
# File 'lib/rubygems/resolver/specification.rb', line 11 def dependencies @dependencies end |
#name ⇒ Object (readonly)
The name of the gem for this specification
16 17 18 |
# File 'lib/rubygems/resolver/specification.rb', line 16 def name @name end |
#platform ⇒ Object (readonly)
The platform this gem works on.
21 22 23 |
# File 'lib/rubygems/resolver/specification.rb', line 21 def platform @platform end |
#set ⇒ Object (readonly)
The set this specification came from.
26 27 28 |
# File 'lib/rubygems/resolver/specification.rb', line 26 def set @set end |
#source ⇒ Object (readonly)
The source for this specification
31 32 33 |
# File 'lib/rubygems/resolver/specification.rb', line 31 def source @source end |
#version ⇒ Object (readonly)
The version of the gem for this specification.
36 37 38 |
# File 'lib/rubygems/resolver/specification.rb', line 36 def version @version end |
Instance Method Details
#full_name ⇒ Object
The name and version of the specification.
Unlike Gem::Specification#full_name, the platform is not included.
55 56 57 |
# File 'lib/rubygems/resolver/specification.rb', line 55 def full_name "#{@name}-#{@version}" end |
#install(options) {|installer| ... } ⇒ Object
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.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/rubygems/resolver/specification.rb', line 65 def install require 'rubygems/installer' destination = [:install_dir] || Gem.dir Gem.ensure_gem_subdirectories destination gem = source.download spec, destination installer = Gem::Installer.new gem, yield installer if block_given? installer.install end |