In Files

  • rubygems/resolver/requirement_list.rb

Parent

Included Modules

Class/Module Index [+]

Quicksearch

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() click to toggle source

Creates a new RequirementList.

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

Public Instance Methods

add(req) click to toggle source

Adds Resolver::DependencyRequest req to this requirements list.

 
               # File rubygems/resolver/requirement_list.rb, line 28
def add(req)
  if req.requirement.exact?
    @exact.push req
  else
    @list.push req
  end
  req
end
            
empty?() click to toggle source

Is the list empty?

 
               # File rubygems/resolver/requirement_list.rb, line 62
def empty?
  @exact.empty? && @list.empty?
end
            
next5() click to toggle source

Returns the oldest five entries from the list.

 
               # File rubygems/resolver/requirement_list.rb, line 77
def next5
  x = @exact[0,5]
  x + @list[0,5 - x.size]
end
            
remove() click to toggle source

Remove the oldest DependencyRequest from the list.

 
               # File rubygems/resolver/requirement_list.rb, line 69
def remove
  return @exact.shift unless @exact.empty?
  @list.shift
end
            
size() click to toggle source

How many elements are in the list

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

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus