Class: Gem::List
- Inherits:
-
Object
- Object
- Gem::List
- Includes:
- Enumerable
- Defined in:
- lib/rubygems/util/list.rb
Instance Attribute Summary collapse
-
#tail ⇒ Object
Returns the value of attribute tail.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(value = nil, tail = nil) ⇒ List
constructor
A new instance of List.
- #prepend(value) ⇒ Object
-
#pretty_print(q) ⇒ Object
:nodoc:.
- #to_a ⇒ Object
Constructor Details
#initialize(value = nil, tail = nil) ⇒ List
Returns a new instance of List.
7 8 9 10 |
# File 'lib/rubygems/util/list.rb', line 7 def initialize(value = nil, tail = nil) @value = value @tail = tail end |
Instance Attribute Details
#tail ⇒ Object
Returns the value of attribute tail.
5 6 7 |
# File 'lib/rubygems/util/list.rb', line 5 def tail @tail end |
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/rubygems/util/list.rb', line 5 def value @value end |
Class Method Details
Instance Method Details
#each ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/rubygems/util/list.rb', line 12 def each n = self while n yield n.value n = n.tail end end |
#prepend(value) ⇒ Object
24 25 26 |
# File 'lib/rubygems/util/list.rb', line 24 def prepend(value) List.new value, self end |
#pretty_print(q) ⇒ Object
:nodoc:
28 29 30 |
# File 'lib/rubygems/util/list.rb', line 28 def pretty_print(q) # :nodoc: q.pp to_a end |
#to_a ⇒ Object
20 21 22 |
# File 'lib/rubygems/util/list.rb', line 20 def to_a super.reverse end |