diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-01 21:50:14 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-01 21:50:14 +0000 |
commit | effdbf5936cc090a618e13c8f9a1b5412ebab2fa (patch) | |
tree | c8410a18cbbe7ad013470fc06fef0c75ce0fd230 /lib/rubygems/util/list.rb | |
parent | 9c4ef4b191a1e6b9abdbb21c7c709d1d0f2397e6 (diff) | |
download | ruby-effdbf5936cc090a618e13c8f9a1b5412ebab2fa.tar.gz |
* lib/rubygems: Update to RubyGems HEAD(c202db2).
this version contains many enhancements see http://git.io/vtNwF
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/util/list.rb')
-rw-r--r-- | lib/rubygems/util/list.rb | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/lib/rubygems/util/list.rb b/lib/rubygems/util/list.rb index 9bc11fe334..6fa767646c 100644 --- a/lib/rubygems/util/list.rb +++ b/lib/rubygems/util/list.rb @@ -1,7 +1,13 @@ module Gem - List = Struct.new(:value, :tail) - class List + include Enumerable + attr_accessor :value, :tail + + def initialize(value = nil, tail = nil) + @value = value + @tail = tail + end + def each n = self while n @@ -11,25 +17,7 @@ module Gem end def to_a - ary = [] - n = self - while n - ary.unshift n.value - n = n.tail - end - - ary - end - - def find - n = self - while n - v = n.value - return v if yield(v) - n = n.tail - end - - nil + super.reverse end def prepend(value) |