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

chunk + to_h not working as expected #1

Open
schneikai opened this issue Mar 11, 2019 · 1 comment
Open

chunk + to_h not working as expected #1

schneikai opened this issue Mar 11, 2019 · 1 comment

Comments

@schneikai
Copy link

hey @look, enjoyed your article and used some of your code in own project. Thank you so much! Just wanted to let you know about a possible small mistake here:

grouped = clauses.chunk { |c| c.operator }.to_h
chunk.to_h is only keeping the last element for each group in the array for each operator. To fix I used grouped = clauses.group_by(&:operator) instead. Ruby version is 2.1.0

@look
Copy link
Owner

look commented Mar 31, 2019

Thanks for the report! I'll take a look and update the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants