Merge pull request #3577 from okkez/fix-return-value-of-each-slice

Change return value of Enumerable#each_slice
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-04-03 18:04:57 +09:00
committed by GitHub
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -155,6 +155,7 @@ module Enumerable
end
end
block.call(ary) unless ary.empty?
nil
end
##
+2 -1
View File
@@ -32,8 +32,9 @@ end
assert("Enumerable#each_slice") do
a = []
(1..10).each_slice(3){|e| a << e}
b = (1..10).each_slice(3){|e| a << e}
assert_equal [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]], a
assert_equal nil, b
end
assert("Enumerable#group_by") do