Skip to content

Commit cc491b9

Browse files
committed
[GR-20160] Make Enumerable#chunk work without a block (#1518).
PullRequest: truffleruby/1198
2 parents d7b6b96 + 0e3b473 commit cc491b9

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
@@ -41,6 +41,7 @@ Bug fixes:
4141
* Make `String#concat` work with no or multiple arguments (#1519).
4242
* Make `Array#concat` work with no or multiple arguments (#1519).
4343
* Fixed BigDecimal coerce initial argument using `to_str` (#1826).
44+
* Make `Enumerable#chunk` work without a block (#1518).
4445

4546
Compatibility:
4647

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)