From: "akr (Akira Tanaka)" <akr@...>
Date: 2012-10-28T23:06:49+09:00
Subject: [ruby-core:48520] [ruby-trunk - Feature #2172] Enumerable#chunk with no block


Issue #2172 has been updated by akr (Akira Tanaka).

Description updated
Target version changed from 2.0.0 to next minor


----------------------------------------
Feature #2172: Enumerable#chunk with no block
https://bugs.ruby-lang.org/issues/2172#change-31884

Author: marcandre (Marc-Andre Lafortune)
Status: Assigned
Priority: Low
Assignee: akr (Akira Tanaka)
Category: core
Target version: next minor


=begin
 What should "(1..3).chunk" (i.e. without a block) do?
 
 It issued an
 ArgumentError: tried to create Proc object without a block
 
 I changed the error message to "no block given" which I hope to be more informative, but maybe there is something more useful to do here?
 
 A default block of {|x| x} doesn't seem all that useful.
 
 Returning an enumerator that, upon completion, will return an enumerator would probably be better, but could also be a bit confusing if someone doesn't realize he forgot to specify the block?
 
 Thanks to Run Paint for raising the question when writing the rubyspec for #chunk.
=end



-- 
http://bugs.ruby-lang.org/