Enumerable arg handling issues for `#chunk`, `#slice_before`, and `#take_while` #901

dmarcotte opened this Issue Jul 22, 2013 · 4 comments


None yet

2 participants


These are holdovers from #898: Enumerable#chunk, Enumerable#slice_before, and Enumerable#take_while handling of multiple args does not match MRI. Here's a script illustrating the difference:

test_enum = Class.new do
  include Enumerable
  def each(&block)
    block.call 1, 2, 3

test_enum.chunk { |obj| p obj == [1, 2, 3] }.each {}
test_enum.chunk { |a,b| p b == 2 }.each {}
test_enum.slice_before { |obj| p obj == [1, 2, 3] }.each {}
test_enum.take_while { |obj| p obj == 1 }

This outputs all true for MRI, and all false for JRuby.

(I'm going to try and fix these... just wanted capture the issue here in the meantime)

headius commented Jul 23, 2013

Thanks for filing. Your other PR has been merged in, and we'd love to get the remaining issues fixed too.


Glad to help! Fixes for the remaining issue are definitely on my radar, so hopefully more news before too long.

headius commented Nov 25, 2013

Rock and roll, @dmarcotte! Thank you!

@headius headius closed this Nov 25, 2013

Glad to help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment