summaryrefslogtreecommitdiff
path: root/lib/rexml/syncenumerator.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-01 05:43:50 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-01 05:43:50 +0000
commit1448668244c81cfc720bcdfa93af352a17cc230f (patch)
tree550af4707b22d099f4d8393e29ef6da424aca813 /lib/rexml/syncenumerator.rb
parent96e7713754c477fe98806b905301356371accb68 (diff)
* lib/rexml: 1.9 patch from Sam Ruby mentioned in his blog:
<http://intertwingly.net/blog/2007/12/31/Porting-REXML-to-Ruby-1-9> [ruby-core:14639] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/syncenumerator.rb')
-rw-r--r--lib/rexml/syncenumerator.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/rexml/syncenumerator.rb b/lib/rexml/syncenumerator.rb
index 955e006cb2..11609bdf3d 100644
--- a/lib/rexml/syncenumerator.rb
+++ b/lib/rexml/syncenumerator.rb
@@ -6,8 +6,7 @@ module REXML
# Enumerable objects.
def initialize(*enums)
@gens = enums
- @biggest = @gens[0]
- @gens.each {|x| @biggest = x if x.size > @biggest.size }
+ @length = @gens.collect {|x| x.size }.max
end
# Returns the number of enumerated Enumerable objects, i.e. the size
@@ -24,8 +23,8 @@ module REXML
# Enumerates rows of the Enumerable objects.
def each
- @biggest.zip( *@gens ) {|a|
- yield(*a[1..-1])
+ @length.times {|i|
+ yield @gens.collect {|x| x[i]}
}
self
end