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#any?, all?, none? and one? now accept a pattern argument #5096

Merged
merged 5 commits into from Mar 21, 2018

Conversation

Projects
None yet
2 participants
@nomadium
Contributor

nomadium commented Mar 20, 2018

Hi folks,

This is another change adding Ruby 2.5 support [1]: Enumerable#any?, all?, none? and one? now accept a pattern argument (feature #11286 [2]).

All associated MRI and ruby/spec tests (except one [3] for #any?) are passing.

Thanks for your review and feedback.

  1. #4876
  2. https://bugs.ruby-lang.org/issues/11286
  3. it "calls the pattern with gathered array when yielded with multiple arguments" do

nomadium added some commits Mar 20, 2018

Enumerable#one? now accept a pattern argument
For more information, please see feature #11286.
Enumerable#none? now accept a pattern argument
For more information, please see feature #11286.
Enumerable#any? now accept a pattern argument
For more information, please see feature #11286.
Enumerable#all? now accept a pattern argument
For more information, please see feature #11286.
@nomadium

This comment has been minimized.

Contributor

nomadium commented Mar 20, 2018

Fixed. I'll get back to the failed test in

it "calls the pattern with gathered array when yielded with multiple arguments" do
later.

All Enumerable tests in ruby-2.5 branch should work with this PR.

I still would like to research and understand why that specific test was failing when each with a block built with JavaInternalBlockBody class is passed but not with one built with BlockCallback.

Fix failing test with Enumerable#any?
Replace each call + JavaInternalBlockBody with callEach + BlockCallback
as is implemented Enumerable#all? as well.

The failed test was:
https://github.com/jruby/jruby/blob/3813f0a53c22af8122e8c2b70c7d87ae35323109/spec/ruby/core/enumerable/any_spec.rb#L214
@nomadium

This comment has been minimized.

Contributor

nomadium commented Mar 21, 2018

@headius headius merged commit 0d9ec85 into jruby:ruby-2.5 Mar 21, 2018

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details

@headius headius added this to the JRuby 9.2.0.0 milestone Mar 21, 2018

@nomadium nomadium deleted the nomadium:enumerable-methods-one-none-any-and-all-now-accept-pattern-argument branch Mar 23, 2018

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