Skip to content

Commit 0e3b473

Browse files
author
Nicolas Laurent
committed
[GR-20160] Make Enumerable#chunk work without a block (#1518)
1 parent b78f6bb commit 0e3b473

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Bug fixes:
4040
* Fixed File.fnmatch causes ArrayIndexOutOfBoundsException (#1845).
4141
* Make `String#concat` work with no or multiple arguments (#1519).
4242
* Make `Array#concat` work with no or multiple arguments (#1519).
43+
* Make `Enumerable#chunk` work without a block (#1518).
4344

4445
Compatibility:
4546

spec/tags/core/enumerable/chunk_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/main/ruby/truffleruby/core/enumerable.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333

3434
module Enumerable
3535
def chunk(&original_block)
36+
return to_enum(:chunk) { enumerator_size } unless block_given?
37+
3638
initial_state = nil
37-
raise ArgumentError, 'no block given' unless block_given?
3839
Enumerator.new do |yielder|
3940
previous = nil
4041
accumulate = []

0 commit comments

Comments
 (0)