rmosolgo / graphql-ruby

Ruby implementation of GraphQL
http://graphql-ruby.org
MIT License
5.38k stars 1.39k forks source link

Allow InputObject instances to be pattern matched via #deconstruct_keys #5170

Closed czan closed 4 days ago

czan commented 4 days ago

This allows Ruby's case/in syntax, like:

case input
in { x:, y: }
  # do something with x and y
end

This is easy for individual projects to add in their own InputObject superclass, but it seems generally useful, so I figured I'd raise a PR with it. No hard feelings if you don't want it upstream. :slightly_smiling_face: