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.
8 9 10 11 |
# File 'lib/rubygems/util/list.rb', line 8 def initialize(value = nil, tail = nil) @value = value @tail = tail end |
Instance Attribute Details
#tail ⇒ Object
Returns the value of attribute tail
6 7 8 |
# File 'lib/rubygems/util/list.rb', line 6 def tail @tail end |
#value ⇒ Object
Returns the value of attribute value
6 7 8 |
# File 'lib/rubygems/util/list.rb', line 6 def value @value end |
Class Method Details
Instance Method Details
#each ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rubygems/util/list.rb', line 13 def each n = self while n yield n.value n = n.tail end end |
#prepend(value) ⇒ Object
25 26 27 |
# File 'lib/rubygems/util/list.rb', line 25 def prepend(value) List.new value, self end |
#pretty_print(q) ⇒ Object
:nodoc:
29 30 31 |
# File 'lib/rubygems/util/list.rb', line 29 def pretty_print(q) # :nodoc: q.pp to_a end |
#to_a ⇒ Object
21 22 23 |
# File 'lib/rubygems/util/list.rb', line 21 def to_a super.reverse end |