class Gem::Resolver::RequirementList - Documentation for Ruby 4.0
Description: class Gem::Resolver::RequirementList: The RequirementList is used to hold the requirements being considered while resolving a set of gems. The RequirementList acts like a queue where the o
Keywords: ruby,class,Gem::Resolver::RequirementList

🔍

No recent searches

# class Gem::Resolver::RequirementList

The `RequirementList` is used to hold the requirements being considered while resolving a set of gems.

The `RequirementList` acts like a queue where the oldest items are removed first.

### Public Class Methods

new ()
Source

    # File lib/rubygems/resolver/requirement_list.rb, line 16
    def initialize
      @exact = []
      @list = []
    end

Creates a new `RequirementList`.

### Public Instance Methods

add (req)
Source

    # File lib/rubygems/resolver/requirement_list.rb, line 29
    def add(req)
      if req.requirement.exact?
        @exact.push req
      else
        @list.push req
      end
      req
    end

Adds Resolver::DependencyRequest `req` to this requirements list.

empty? ()
Source

    # File lib/rubygems/resolver/requirement_list.rb, line 63
    def empty?
      @exact.empty? && @list.empty?
    end

Is the list empty?

next5 ()
Source

    # File lib/rubygems/resolver/requirement_list.rb, line 78
    def next5
      x = @exact[0,5]
      x + @list[0,5 - x.size]
    end

Returns the oldest five entries from the list.

remove ()
Source

    # File lib/rubygems/resolver/requirement_list.rb, line 70
    def remove
      return @exact.shift unless @exact.empty?
      @list.shift
    end

Remove the oldest DependencyRequest from the list.

size ()
Source

    # File lib/rubygems/resolver/requirement_list.rb, line 56
    def size
      @exact.size + @list.size
    end

How many elements are in the list