lib/cartesian_iterator.rb in cartesian-0.6.6 vs lib/cartesian_iterator.rb in cartesian-0.6.7
- old
+ new
@@ -56,17 +56,17 @@
elems = []
for list in @lists
elems << list.restart_and_raw_next
end
- if RUBY_VERSION <= '1.9.1'; yield(*elems.map {|x| x }); else; yield(*elems); end # Yeah, v.map{|x|x} should be equal to v, but strangely it is NOT in Ruby versions prior to 1.9.2.
+ yield(*elems.dup)
last_list_index = @lists.size-1
n = last_list_index
loop do
if !@lists[n].done?
elems[n] = @lists[n].raw_next
- if RUBY_VERSION <= '1.9.1'; yield(*elems.map {|x| x }); else; yield(*elems); end # See previous comment.
+ yield(*elems.dup)
n = last_list_index
next
elsif n > 0
elems[n] = @lists[n].restart_and_raw_next
n -= 1