Specifies a Specification object that should be activated. Also contains a dependency that was used to introduce this activation.
Creates a new ActivationRequest that
will activate spec. The parent request is used
to provide diagnostics in case of conflicts.
others_possible indicates that other specifications may also
match this activation request.
# File rubygems/resolver/activation_request.rb, line 24
def initialize spec, request, others_possible = true
@spec = spec
@request = request
@others_possible = others_possible
end
Is this activation request for a development dependency?
# File rubygems/resolver/activation_request.rb, line 44
def development?
@request.development?
end
Downloads a gem at path and returns the file path.
# File rubygems/resolver/activation_request.rb, line 51
def download path
if @spec.respond_to? :source
source = @spec.source
else
source = Gem.sources.first
end
Gem.ensure_gem_subdirectories path
source.download full_spec, path
end
The full name of the specification to be activated.
# File rubygems/resolver/activation_request.rb, line 66
def full_name
@spec.full_name
end
The Gem::Specification for this activation request.
# File rubygems/resolver/activation_request.rb, line 73
def full_spec
Gem::Specification === @spec ? @spec : @spec.spec
end
True if the requested gem has already been installed.
# File 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
The name of this activation request’s specification
# File rubygems/resolver/activation_request.rb, line 115
def name
@spec.name
end
Indicate if this activation is one of a set of possible requests for the same Dependency request.
# File 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
Return the ActivationRequest that contained the dependency that we were activated for.
# File rubygems/resolver/activation_request.rb, line 136
def parent
@request.requester
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.