Class: Gem::Resolver::RequirementList
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Instance Chain: 
          self,
          Enumerable
         | |
| Inherits: | Object | 
| Defined in: | lib/rubygems/resolver/requirement_list.rb | 
Overview
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.
Class Method Summary
- 
    
      .new  ⇒ RequirementList 
    
    constructor
    Creates a new RequirementList.
Instance Attribute Summary
- 
    
      #empty?  ⇒ Boolean 
    
    readonly
    Is the list empty? 
Instance Method Summary
- 
    
      #add(req)  
    
    Adds DependencyRequestreqto this requirements list.
- 
    
      #next5  
    
    Returns the oldest five entries from the list. 
- 
    
      #remove  
    
    Remove the oldest DependencyRequestfrom the list.
- 
    
      #size  
    
    How many elements are in the list. 
- 
    
      #each  
    
    Internal use only
    Enumerates requirements in the list. 
- #initialize_copy(other) Internal use only
Constructor Details
    .new  ⇒ RequirementList 
  
Creates a new RequirementList.
# File 'lib/rubygems/resolver/requirement_list.rb', line 16
def initialize @exact = [] @list = [] end
Instance Attribute Details
    #empty?  ⇒ Boolean  (readonly)
  
Is the list empty?
# File 'lib/rubygems/resolver/requirement_list.rb', line 63
def empty? @exact.empty? && @list.empty? end
Instance Method Details
#add(req)
Adds DependencyRequest req to this requirements list.
# 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
#each
    This method is for internal use only.
  
Enumerates requirements in the list
# File 'lib/rubygems/resolver/requirement_list.rb', line 41
def each # :nodoc: return enum_for __method__ unless block_given? @exact.each do |requirement| yield requirement end @list.each do |requirement| yield requirement end end
#initialize_copy(other)
    This method is for internal use only.
  
  [ GitHub ]
# File 'lib/rubygems/resolver/requirement_list.rb', line 21
def initialize_copy(other) # :nodoc: @exact = @exact.dup @list = @list.dup end
#next5
Returns the oldest five entries from the list.
# File 'lib/rubygems/resolver/requirement_list.rb', line 78
def next5 x = @exact[0,5] x + @list[0,5 - x.size] end
#remove
Remove the oldest DependencyRequest from the list.
# File 'lib/rubygems/resolver/requirement_list.rb', line 70
def remove return @exact.shift unless @exact.empty? @list.shift end
#size
How many elements are in the list
# File 'lib/rubygems/resolver/requirement_list.rb', line 56
def size @exact.size + @list.size end