A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.rubydoc.info/github/rubygems/rubygems/Gem/List below:

List – Documentation for rubygems/rubygems (master) – RubyDoc.info

Class: Gem::List
Inherits:
Object show all
Includes:
Enumerable
Defined in:
lib/rubygems/util/list.rb
Overview

The Gem::List class is currently unused and will be removed in the next major rubygems version

Instance Attribute Summary collapse Class Method Summary collapse Instance Method Summary collapse Constructor Details #initialize(value = nil, tail = nil) ⇒ List

Returns a new instance of List.

9
10
11
12
# File 'lib/rubygems/util/list.rb', line 9

def initialize(value = nil, tail = nil)
  @value = value
  @tail = tail
end
Instance Attribute Details #tail ⇒ Object

Returns the value of attribute tail.

7
8
9
# File 'lib/rubygems/util/list.rb', line 7

def tail
  @tail
end
#value ⇒ Object

Returns the value of attribute value.

7
8
9
# File 'lib/rubygems/util/list.rb', line 7

def value
  @value
end
Class Method Details .prepend(list, value) ⇒ Object
34
35
36
37
# File 'lib/rubygems/util/list.rb', line 34

def self.prepend(list, value)
  return List.new(value) unless list
  List.new value, list
end
Instance Method Details #each ⇒ Object
14
15
16
17
18
19
20
# File 'lib/rubygems/util/list.rb', line 14

def each
  n = self
  while n
    yield n.value
    n = n.tail
  end
end
#prepend(value) ⇒ Object
26
27
28
# File 'lib/rubygems/util/list.rb', line 26

def prepend(value)
  List.new value, self
end
#pretty_print(q) ⇒ Object
30
31
32
# File 'lib/rubygems/util/list.rb', line 30

def pretty_print(q)   q.pp to_a
end
#to_a ⇒ Object
22
23
24
# File 'lib/rubygems/util/list.rb', line 22

def to_a
  super.reverse
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4