Class: Gem::Resolver::ActivationRequest
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rubygems/resolver/activation_request.rb |
Overview
Specifies a Specification object that should be activated. Also contains a dependency that was used to introduce this activation.
Class Method Summary
-
.new(spec, request, others_possible = true) ⇒ ActivationRequest
constructor
Creates a new
ActivationRequest
that will activate #spec.
Instance Attribute Summary
-
#development? ⇒ Boolean
readonly
Is this activation request for a development dependency?
-
#installed? ⇒ Boolean
readonly
True if the requested gem has already been installed.
-
#others_possible? ⇒ Boolean
readonly
Indicate if this activation is one of a set of possible requests for the same ::Gem::Dependency request.
-
#request
readonly
The parent request for this activation request.
-
#spec
readonly
The specification to be activated.
Instance Method Summary
-
#download(path)
Downloads a gem at Gem.path and returns the file path.
-
#full_name
The full name of the specification to be activated.
-
#full_spec
The ::Gem::Specification for this activation request.
-
#name
The name of this activation request's specification.
-
#parent
Return the
ActivationRequest
that contained the dependency that we were activated for. -
#version
The version of this activation request's specification.
Constructor Details
.new(spec, request, others_possible = true) ⇒ ActivationRequest
Instance Attribute Details
#development? ⇒ Boolean
(readonly)
Is this activation request for a development dependency?
# File 'lib/rubygems/resolver/activation_request.rb', line 44
def development? @request.development? end
#installed? ⇒ Boolean
(readonly)
True if the requested gem has already been installed.
# File 'lib/rubygems/resolver/activation_request.rb', line 99
def installed? case @spec when Gem::Resolver::VendorSpecification then true else this_spec = full_spec Gem::Specification.any? do |s| s == this_spec end end end
#others_possible? ⇒ Boolean
(readonly)
Indicate if this activation is one of a set of possible requests for the same ::Gem::Dependency request.
# File 'lib/rubygems/resolver/activation_request.rb', line 123
def others_possible? case @others_possible when true, false then @others_possible else not @others_possible.empty? end end
#request (readonly)
The parent request for this activation request.
# File 'lib/rubygems/resolver/activation_request.rb', line 10
attr_reader :request
#spec (readonly)
The specification to be activated.
# File 'lib/rubygems/resolver/activation_request.rb', line 15
attr_reader :spec
Instance Method Details
#download(path)
Downloads a gem at Gem.path and returns the file path.
#full_name
The full name of the specification to be activated.
# File 'lib/rubygems/resolver/activation_request.rb', line 66
def full_name @spec.full_name end
#full_spec
The ::Gem::Specification for this activation request.
# File 'lib/rubygems/resolver/activation_request.rb', line 73
def full_spec Gem::Specification === @spec ? @spec : @spec.spec end
#name
The name of this activation request's specification
# File 'lib/rubygems/resolver/activation_request.rb', line 115
def name @spec.name end
#parent
Return the ActivationRequest
that contained the dependency that we were activated for.
# File 'lib/rubygems/resolver/activation_request.rb', line 136
def parent @request.requester end
#version
The version of this activation request's specification
# File 'lib/rubygems/resolver/activation_request.rb', line 167
def version @spec.version end