Skip to content

Commit

Permalink
Only use kwargs splat operator on Ruby 2.7+
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pixeltrix committed Sep 11, 2020
1 parent b7e27b3 commit 6cd9091
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/sprockets/rails/helper.rb
Expand Up @@ -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)
Expand Down

0 comments on commit 6cd9091

Please sign in to comment.