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

Add several Enumerable, Iterator and Array overloads that accept a pattern #7174

Merged
merged 1 commit into from Dec 16, 2018

Conversation

Projects
None yet
5 participants
@asterite
Copy link
Contributor

asterite commented Dec 11, 2018

Implements #7169

Most of the diff is comments, the real meat is very little code but it adds several new concise ways to write things.

Show resolved Hide resolved src/enumerable.cr
@RX14
Copy link
Member

RX14 left a comment

Looks great!

@@ -747,12 +774,32 @@ describe "Enumerable" do
it "rejects the values for which the block returns true" do
[1, 2, 3, 4].reject(&.even?).should eq([1, 3])
end

it "rejects with pattern" do
[1, 2, 3, 4].reject(&.even?).should eq([1, 3])

This comment has been minimized.

@RX14

RX14 Dec 14, 2018

Member

You forgot to modify this example :)

This comment has been minimized.

@asterite

asterite Dec 14, 2018

Author Contributor

Wow, good catch! It seems I even forgot to implement reject(pattern), lol :-P

@RX14

This comment has been minimized.

Copy link
Member

RX14 commented Dec 14, 2018

And needs a rebase on #7176

@asterite asterite force-pushed the asterite:feature/enumerable-pattern branch from c26ca37 to b460c3b Dec 14, 2018

@asterite

This comment has been minimized.

Copy link
Contributor Author

asterite commented Dec 14, 2018

Fixed and rebased. Let's see what CI says.

@asterite

This comment has been minimized.

Copy link
Contributor Author

asterite commented Dec 14, 2018

@RX14 CI passed 😉

@RX14 RX14 merged commit a667e5e into crystal-lang:master Dec 16, 2018

4 checks passed

ci/circleci: test_darwin Your tests passed on CircleCI!
Details
ci/circleci: test_linux Your tests passed on CircleCI!
Details
ci/circleci: test_linux32 Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@RX14 RX14 added this to the 0.27.1 milestone Dec 16, 2018

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