class Gem::Resolver::DependencyRequest - Documentation for Ruby 4.0
Description: class Gem::Resolver::DependencyRequest: Used Internally. Wraps a Dependency object to also track which spec contained the Dependency.
Keywords: ruby,class,Gem::Resolver::DependencyRequest

🔍

No recent searches

# class Gem::Resolver::DependencyRequest

Used Internally. Wraps a Dependency object to also track which spec contained the Dependency.

### Attributes

dependency [R]

The wrapped `Gem::Dependency`

requester [R]

The request for this dependency.

### Public Class Methods

new (dependency, requester)
Source

    # File lib/rubygems/resolver/dependency_request.rb, line 22
    def initialize(dependency, requester)
      @dependency = dependency
      @requester  = requester
    end

Creates a new `DependencyRequest` for `dependency` from `requester`. +requester may be nil if the request came from a user.

### Public Instance Methods

development? ()
Source

    # File lib/rubygems/resolver/dependency_request.rb, line 41
    def development?
      @dependency.type == :development
    end

Is this dependency a development dependency?

explicit? ()
Source

    # File lib/rubygems/resolver/dependency_request.rb, line 78
    def explicit?
      @requester.nil?
    end

Indicate that the request is for a gem explicitly requested by the user

implicit? ()
Source

    # File lib/rubygems/resolver/dependency_request.rb, line 86
    def implicit?
      !explicit?
    end

Indicate that the request is for a gem requested as a dependency of another gem

match? (spec, allow_prerelease = false)
Source

    # File lib/rubygems/resolver/dependency_request.rb, line 51
    def match?(spec, allow_prerelease = false)
      @dependency.match? spec, nil, allow_prerelease
    end

Does this dependency request match `spec`?

NOTE: `match?` only matches prerelease versions when `dependency` is a prerelease dependency.

matches_spec? (spec)
Source

    # File lib/rubygems/resolver/dependency_request.rb, line 60
    def matches_spec?(spec)
      @dependency.matches_spec? spec
    end

Does this dependency request match `spec`?

NOTE: `matches_spec?` matches prerelease versions. See also `match?`

name ()
Source

    # File lib/rubygems/resolver/dependency_request.rb, line 67
    def name
      @dependency.name
    end

The name of the gem this dependency request is requesting.

request_context ()
Source

    # File lib/rubygems/resolver/dependency_request.rb, line 94
    def request_context
      @requester ? @requester.request : "(unknown)"
    end

Return a `String` indicating who caused this request to be added (only valid for implicit requests)

requirement ()
Source

    # File lib/rubygems/resolver/dependency_request.rb, line 112
    def requirement
      @dependency.requirement
    end

The version requirement for this dependency request

type ()
Source

    # File lib/rubygems/resolver/dependency_request.rb, line 71
    def type
      @dependency.type
    end