class Gem::Resolver::ActivationRequest - Documentation for Ruby 4.1
Description: class Gem::Resolver::ActivationRequest: Specifies a Specification object that should be activated. Also contains a dependency that was used to introduce this activation.
Keywords: ruby,class,Gem::Resolver::ActivationRequest

🔍

No recent searches

# 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)
Source

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

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

### Public Instance Methods

development? ()
Source

    # File lib/rubygems/resolver/activation_request.rb, line 49
    def development?
      @request.development?
    end

Is this activation request for a development dependency?

download (path)
Source

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

      if @spec.respond_to? :sources
        exception = nil
        path = @spec.sources.find do |source|
          source.download full_spec, path
        rescue exception
        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

Downloads a gem at `path` and returns the file path.

eql? (other)
Source

    # File lib/rubygems/resolver/activation_request.rb, line 38
    def eql?(other)
      self == other
    end

full_name ()
Source

    # File lib/rubygems/resolver/activation_request.rb, line 81
    def full_name
      name_tuple.full_name
    end

The full name of the specification to be activated.

Also aliased as: to_s
full_spec ()
Source

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

The `Gem::Specification` for this activation request.

hash ()
Source

    # File lib/rubygems/resolver/activation_request.rb, line 42
    def hash
      @spec.hash
    end

installed? ()
Source

    # File lib/rubygems/resolver/activation_request.rb, line 101
    def installed?
      case @spec
      when Gem::Resolver::VendorSpecification then
        true
      else
        this_spec = full_spec

        Gem::Specification.any? do |s|
          s == this_spec && s.base_dir == this_spec.base_dir
        end
      end
    end

True if the requested gem has already been installed.

name ()
Source

    # File lib/rubygems/resolver/activation_request.rb, line 117
    def name
      @spec.name
    end

The name of this activation request’s specification

parent ()
Source

    # File lib/rubygems/resolver/activation_request.rb, line 125
    def parent
      @request.requester
    end

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

platform ()
Source

    # File lib/rubygems/resolver/activation_request.rb, line 150
    def platform
      @spec.platform
    end

The platform of this activation request’s specification

to_s ()
Alias for: full_name
version ()
Source

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

The version of this activation request’s specification

### Private Instance Methods

name_tuple ()
Source

    # File lib/rubygems/resolver/activation_request.rb, line 156
    def name_tuple
      @name_tuple ||= Gem::NameTuple.new(name, version, platform)
    end