From: rubikitch@... Date: 2008-05-12T00:52:52+09:00 Subject: [ruby-dev:34653] enum_for(:each_with_index)の相違 るびきちです。 Ruby 1.8.7とRuby 1.9の each_with_index のEnumeratorの挙動が異なります。 require 'enumerator' RUBY_VERSION # => "1.8.6" %w[foo bar].enum_for(:each_with_index).select {|x,i| i>=1 } # => [["bar", 1]] require 'enumerator' RUBY_VERSION # => "1.8.7" %w[foo bar].enum_for(:each_with_index).select {|x,i| i>=1 } # => [["bar", 1]] require 'enumerator' RUBY_VERSION # => "1.9.0" %w[foo bar].enum_for(:each_with_index).select {|x,i| i>=1 } # => ["bar"] RUBY_VERSION # => "1.8.7" %w[foo bar].each_with_index.select {|x,i| i>=1 } # => [["bar", 1]] RUBY_VERSION # => "1.9.0" %w[foo bar].each_with_index.select {|x,i| i>=1 } # => ["bar"] -- rubikitch Blog: http://d.hatena.ne.jp/rubikitch/ Site: http://www.rubyist.net/~rubikitch/