From: Sylvain Joyeux Date: 2010-02-01T05:09:33+09:00 Subject: [ruby-core:27985] [Bug #2702] Enumerator#to_a and #to_set yield inconsistent results Bug #2702: Enumerator#to_a and #to_set yield inconsistent results http://redmine.ruby-lang.org/issues/show/2702 Author: Sylvain Joyeux Status: Open, Priority: Normal Category: lib ruby -v: ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux] If I run #to_a and #to_set on an Enumerator with a multiple-argument yield, then I get the following: [~]% cat test_to_set.rb require 'set' def enumerate yield(1, 2, 3) yield(4, 5, 6) end STDERR.puts enum_for(:enumerate).class STDERR.puts enum_for(:enumerate).to_a.inspect STDERR.puts enum_for(:enumerate).to_set.inspect [~]% ruby1.9.1 test_to_set.rb Enumerator [[1, 2, 3], [4, 5, 6]] # Namely, #to_a captures all the arguments provided to yield() while #to_set only gets the first one. I guess that the #to_set behaviour is a bug (isn't it ?) ---------------------------------------- http://redmine.ruby-lang.org