Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dmarcotte opened this Issue Jul 22, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@dmarcotte
Copy link
Contributor

dmarcotte commented Jul 22, 2013

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
  end
end.new

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

This comment has been minimized.

Copy link
Member

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.

@dmarcotte

This comment has been minimized.

Copy link
Contributor Author

dmarcotte commented Jul 24, 2013

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

@headius

This comment has been minimized.

Copy link
Member

headius commented Nov 25, 2013

Rock and roll, @dmarcotte! Thank you!

@headius headius closed this Nov 25, 2013

@dmarcotte

This comment has been minimized.

Copy link
Contributor Author

dmarcotte commented Nov 25, 2013

Glad to help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.