Shopify / statsd-instrument

A StatsD client for Ruby apps. Provides metaprogramming methods to inject StatsD instrumentation into your code.
http://shopify.github.io/statsd-instrument
MIT License
574 stars 97 forks source link

Fix delegation for Ruby 2.7 compatibility #265

Closed casperisfine closed 4 years ago

casperisfine commented 4 years ago

statsd-instrument decorators are throwing warnings on Ruby 2.7:

DEPRECATION WARNING: /tmp/bundle/ruby/2.7.0/gems/statsd-instrument-2.9.2/lib/statsd/instrument/strict.rb:130: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
xxxxxx:103: warning: The called method `XXXXXX' is defined here
 (called from block (3 levels) in statsd_measure at /tmp/bundle/ruby/2.7.0/gems/statsd-instrument-2.9.2/lib/statsd/instrument/strict.rb:130)

While not very elegant, the ruby2_keywords modifier is the only proper way to do blind argument forwarding on both 2.6 and 2.7 without warnings.

casperisfine commented 4 years ago

Would also need to be backported to the 2.x branch.

wvanbergen commented 4 years ago

I am not a big fan of the metaprogramming methods, so I don't mind using the ugly fix here. I may officially deprecate them at some point.