class Gem::Resolver::ActivationRequest

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

Attributes

request[R]

The parent request for this activation request.

spec[R]

The specification to be activated.

Public Class Methods

new(spec, request) click to toggle source

Creates a new ActivationRequest that will activate spec. The parent request is used to provide diagnostics in case of conflicts.

# File rubygems/resolver/activation_request.rb, line 22
def initialize(spec, request)
  @spec = spec
  @request = request
end

Public Instance Methods

development?() click to toggle source

Is this activation request for a development dependency?

# File rubygems/resolver/activation_request.rb, line 41
def development?
  @request.development?
end
download(path) click to toggle source

Downloads a gem at path and returns the file path.

# File rubygems/resolver/activation_request.rb, line 48
def download(path)
  Gem.ensure_gem_subdirectories path

  if @spec.respond_to? :sources
    exception = nil
    path = @spec.sources.find do |source|
      begin
        source.download full_spec, path
      rescue exception
      end
    end
    return path      if path
    raise  exception if exception

  elsif @spec.respond_to? :source
    source = @spec.source
    source.download full_spec, path

  else
    source = Gem.sources.first
    source.download full_spec, path
  end
end
full_name() click to toggle source

The full name of the specification to be activated.

# File rubygems/resolver/activation_request.rb, line 75
def full_name
  name_tuple.full_name
end
Also aliased as: to_s
full_spec() click to toggle source

The Gem::Specification for this activation request.

# File rubygems/resolver/activation_request.rb, line 84
def full_spec
  Gem::Specification === @spec ? @spec : @spec.spec
end
installed?() click to toggle source

True if the requested gem has already been installed.

# File rubygems/resolver/activation_request.rb, line 97
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() click to toggle source

The name of this activation request’s specification

# File rubygems/resolver/activation_request.rb, line 113
def name
  @spec.name
end
parent() click to toggle source

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

# File rubygems/resolver/activation_request.rb, line 121
def parent
  @request.requester
end
platform() click to toggle source

The platform of this activation request’s specification

# File rubygems/resolver/activation_request.rb, line 146
def platform
  @spec.platform
end
to_s()
Alias for: full_name
version() click to toggle source

The version of this activation request’s specification

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

Private Instance Methods

name_tuple() click to toggle source
# File rubygems/resolver/activation_request.rb, line 152
def name_tuple
  @name_tuple ||= Gem::NameTuple.new(name, version, platform)
end