Skip to content

Commit c388c28

Browse files
committed
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.
1 parent 789c682 commit c388c28

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/sprockets/rails/helper.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,16 @@ def find_debug_asset(path)
352352
end
353353

354354
private
355-
def find_asset(path, options = {})
356-
@env[path, **options]
355+
if RUBY_VERSION >= "2.7"
356+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
357+
def find_asset(path, options = {})
358+
@env[path, **options]
359+
end
360+
RUBY
361+
else
362+
def find_asset(path, options = {})
363+
@env[path, options]
364+
end
357365
end
358366

359367
def precompiled?(path)

0 commit comments

Comments
 (0)