frozen_string_literal: false

Specifies a Specification object that should be activated. Also contains a dependency that was used to introduce this activation.

Methods
D
F
I
N
O
P
T
V
Attributes
[R] request

The parent request for this activation request.

[R] spec

The specification to be activated.

Class Public methods
new(spec, request, others_possible = true)

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 lib/rubygems/resolver/activation_request.rb, line 25
def initialize spec, request, others_possible = true
  @spec = spec
  @request = request
  @others_possible = others_possible
end
Instance Public methods
development?()

Is this activation request for a development dependency?

# File lib/rubygems/resolver/activation_request.rb, line 45
def development?
  @request.development?
end
download(path)

Downloads a gem at path and returns the file path.

# File lib/rubygems/resolver/activation_request.rb, line 52
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
full_name()

The full name of the specification to be activated.

Also aliased as: to_s
# File lib/rubygems/resolver/activation_request.rb, line 67
def full_name
  @spec.full_name
end
full_spec()

The Gem::Specification for this activation request.

# File lib/rubygems/resolver/activation_request.rb, line 76
def full_spec
  Gem::Specification === @spec ? @spec : @spec.spec
end
installed?()

True if the requested gem has already been installed.

# File lib/rubygems/resolver/activation_request.rb, line 102
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
name()

The name of this activation request's specification

# File lib/rubygems/resolver/activation_request.rb, line 118
def name
  @spec.name
end
others_possible?()

Indicate if this activation is one of a set of possible requests for the same Dependency request.

# File lib/rubygems/resolver/activation_request.rb, line 126
def others_possible?
  case @others_possible
  when true, false then
    @others_possible
  else
    not @others_possible.empty?
  end
end
parent()

Return the ActivationRequest that contained the dependency that we were activated for.

# File lib/rubygems/resolver/activation_request.rb, line 139
def parent
  @request.requester
end
to_s()
Alias for: full_name
version()

The version of this activation request's specification

# File lib/rubygems/resolver/activation_request.rb, line 170
def version
  @spec.version
end