Support for the Ruby 2.1 series ended on March 31 2017. See here for details.

In Files

  • rubygems/util/list.rb

Class/Module Index [+]

Quicksearch

Gem::List

Public Class Methods

prepend(list, value) click to toggle source
 
               # File rubygems/util/list.rb, line 43
def self.prepend(list, value)
  return List.new(value) unless list
  List.new value, list
end
            

Public Instance Methods

each() click to toggle source
 
               # File rubygems/util/list.rb, line 5
def each
  n = self
  while n
    yield n.value
    n = n.tail
  end
end
            
find() click to toggle source
 
               # File rubygems/util/list.rb, line 24
def find
  n = self
  while n
    v = n.value
    return v if yield(v)
    n = n.tail
  end

  nil
end
            
prepend(value) click to toggle source
 
               # File rubygems/util/list.rb, line 35
def prepend(value)
  List.new value, self
end
            
to_a() click to toggle source
 
               # File rubygems/util/list.rb, line 13
def to_a
  ary = []
  n = self
  while n
    ary.unshift n.value
    n = n.tail
  end

  ary
end