lib/graphql/backwards_compatibility.rb in graphql-1.7.14 vs lib/graphql/backwards_compatibility.rb in graphql-1.8.0.pre1
- old
+ new
@@ -10,14 +10,13 @@
# If a wrapper is applied, warn the application with `name`.
#
# If `last`, then use the last arguments to call the function.
def wrap_arity(callable, from:, to:, name:, last: false)
arity = get_arity(callable)
- case arity
- when to
+ if arity == to || arity < 0
# It already matches, return it as is
callable
- when from
+ elsif arity == from
# It has the old arity, so wrap it with an arity converter
message ="#{name} with #{from} arguments is deprecated, it now accepts #{to} arguments, see:"
backtrace = caller(0, 20)
# Find the first line in the trace that isn't library internals:
user_line = backtrace.find {|l| l !~ /lib\/graphql/ }