Class: Gem::List
- Inherits:
-
Struct
- Object
- Struct
- Gem::List
- Defined in:
- lib/rubygems/util/list.rb,
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
- #find ⇒ Object
- #prepend(value) ⇒ Object
-
#pretty_print(q) ⇒ Object
:nodoc:.
- #to_a ⇒ Object
Instance Attribute Details
#tail ⇒ Object
Returns the value of attribute tail
2 3 4 |
# File 'lib/rubygems/util/list.rb', line 2 def tail @tail end |
#value ⇒ Object
Returns the value of attribute value
2 3 4 |
# File 'lib/rubygems/util/list.rb', line 2 def value @value end |
Class Method Details
Instance Method Details
#each ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/rubygems/util/list.rb', line 5 def each n = self while n yield n.value n = n.tail end end |
#find ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# 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) ⇒ Object
35 36 37 |
# File 'lib/rubygems/util/list.rb', line 35 def prepend(value) List.new value, self end |
#pretty_print(q) ⇒ Object
:nodoc:
39 40 41 |
# File 'lib/rubygems/util/list.rb', line 39 def pretty_print q # :nodoc: q.pp to_a end |
#to_a ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# 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 |