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

Fix ruby 2.7 keyword arguments warning #127

Merged
merged 2 commits into from
Apr 21, 2020
Merged

Conversation

dylanahsmith
Copy link
Contributor

@dylanahsmith dylanahsmith commented Apr 21, 2020

Fixes #126

Problem

GraphQL::Batch::Loader was using *group_args for forwarding arguments which won't forward keyword arguments in the future which may be used by the loader (e.g. we do that in the RecordLoader example).

Solution

Use *group_args for argument forwarding for older ruby versions, since passing keyword arguments an initializer that doesn't take them causes problems for old versions of ruby.

As an optimization, I used ... syntax for argument forwarding for MRI ruby 2.7+ which avoids some object allocation for the splat parameters. I had to eval the ruby code using the new syntax to avoid causing parsing problems for older versions of ruby.

I also changed the CI config to test ruby 2.7.

@dylanahsmith dylanahsmith force-pushed the fix-kwarg-warning branch 4 times, most recently from 9cd5976 to da66dc0 Compare April 21, 2020 17:19
Copy link
Contributor

@swalkinshaw swalkinshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool to see ... in action 👍

@dylanahsmith dylanahsmith merged commit 4a9feba into master Apr 21, 2020
@dylanahsmith dylanahsmith deleted the fix-kwarg-warning branch April 21, 2020 18:43
ksylvest pushed a commit to ksylvest/graphql-batch that referenced this pull request Feb 24, 2021
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

Successfully merging this pull request may close these issues.

Ruby 2.7 keyword arguments warning
2 participants