class Gem::List

Public Class Methods

prepend(list, value) click to toggle source
# File lib/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() { |value| ... } click to toggle source
# File lib/rubygems/util/list.rb, line 5
def each
  n = self
  while n
    yield n.value
    n = n.tail
  end
end
find() { |v| ... } click to toggle source
# File lib/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 lib/rubygems/util/list.rb, line 35
def prepend(value)
  List.new value, self
end
to_a() click to toggle source
# File lib/rubygems/util/list.rb, line 13
def to_a
  ary = []
  n = self
  while n
    ary.unshift n.value
    n = n.tail
  end

  ary
end