[#77789] [Ruby trunk Feature#12012] Add Boolean method — prodis@...
Issue #12012 has been updated by Fernando Hamasaki de Amorim.
4 messages
2016/10/27
[ruby-core:77483] [Ruby trunk Feature#2172] Enumerable#chunk with no block
From:
ruby-core@...
Date:
2016-10-04 18:30:07 UTC
List:
ruby-core #77483
Issue #2172 has been updated by Marc-Andre Lafortune.
Great, thanks!
Done for `chunk`.
Matz, I imagine I should do the same for `chunk_while`, `slice_after`, `slice_before` and `slice_when`, right?
----------------------------------------
Feature #2172: Enumerable#chunk with no block
https://bugs.ruby-lang.org/issues/2172#change-60751
* Author: Marc-Andre Lafortune
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
=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
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>