Shopify / deprecation_toolkit

⚒Eliminate deprecations from your codebase ⚒
MIT License
460 stars 40 forks source link

Handle the other two part warning from Ruby 2.7 #46

Closed casperisfine closed 4 years ago

casperisfine commented 4 years ago

Followup to: https://github.com/Shopify/deprecation_toolkit/pull/45

There is a second type of multipart warning I missed:

def foo(hash, a: 1, b: 1)
  ...
end

foo(bar: 42)

In this case Ruby 2.7 complains because it's ambiguous wether you expect to pass the first parameter as a hash, or if you expected to pass keyword args.

Ruby expects you to call the method with explicit brackets:

foo({ bar: 42 })

Or better avoid this kind of method signatures.