Fix ruby 2.7 keyword arguments warning #127
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.