Class: Gem::List (Ruby 2.3.4)

In Files

  • rubygems/util/list.rb

Parent

Included Modules

Class/Module Index [+]

Quicksearch

Gem::List

Attributes

tail[RW]
value[RW]

Public Class Methods

new(value = nil, tail = nil)
 
               # File rubygems/util/list.rb, line 7
def initialize(value = nil, tail = nil)
  @value = value
  @tail = tail
end
            
prepend(list, value)
 
               # File rubygems/util/list.rb, line 32
def self.prepend(list, value)
  return List.new(value) unless list
  List.new value, list
end
            

Public Instance Methods

each()
 
               # File rubygems/util/list.rb, line 12
def each
  n = self
  while n
    yield n.value
    n = n.tail
  end
end
            
prepend(value)
 
               # File rubygems/util/list.rb, line 24
def prepend(value)
  List.new value, self
end
            
to_a()
 
               # File rubygems/util/list.rb, line 20
def to_a
  super.reverse
end