From 6cd9091bd2cca7764a6f375bedc0c2f757b24140 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Fri, 11 Sep 2020 18:16:36 +0100 Subject: [PATCH] Only use kwargs splat operator on Ruby 2.7+ This gem supports a lot of Ruby/Rails versions so we'd need to bump the major version if we wanted to break backwards compatibility. --- lib/sprockets/rails/helper.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/sprockets/rails/helper.rb b/lib/sprockets/rails/helper.rb index 102798e1..20cc4d32 100644 --- a/lib/sprockets/rails/helper.rb +++ b/lib/sprockets/rails/helper.rb @@ -352,8 +352,16 @@ def find_debug_asset(path) end private - def find_asset(path, options = {}) - @env[path, **options] + if RUBY_VERSION >= "2.7" + class_eval <<-RUBY, __FILE__, __LINE__ + 1 + def find_asset(path, options = {}) + @env[path, **options] + end + RUBY + else + def find_asset(path, options = {}) + @env[path, options] + end end def precompiled?(path)