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 | |
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')
-rw-r--r-- | lib/rubygems/util/list.rb | 30 | ||||
-rw-r--r-- | lib/rubygems/util/stringio.rb | 34 |
2 files changed, 9 insertions, 55 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) diff --git a/lib/rubygems/util/stringio.rb b/lib/rubygems/util/stringio.rb deleted file mode 100644 index 2ea69617bc..0000000000 --- a/lib/rubygems/util/stringio.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Gem::StringSink - def initialize - @string = "" - end - - attr_reader :string - - def write(s) - @string += s - s.size - end - - def set_encoding(enc) - @string.force_encoding enc - end -end - -class Gem::StringSource - def initialize(str) - @string = str.dup - end - - def read(count=nil) - if count - @string.slice!(0,count) - else - s = @string - @string = "" - s - end - end - - alias_method :readpartial, :read -end |