Skip to content

Commit

Permalink
Simplify detection of %s in custom_command
Browse files Browse the repository at this point in the history
This uses the cheaper include? to determine if %s is in custom_command.
It also simplifies the expression with a safe operator.
  • Loading branch information
ekohl committed Sep 13, 2024
1 parent 1abd3c1 commit c5c0886
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet_x/bodeco/archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def extract(path = root_dir, opts = {})
custom_command = opts.fetch(:custom_command, nil)
options = opts.fetch(:options)
Dir.chdir(path) do
cmd = if custom_command && custom_command =~ %r{%s}
cmd = if custom_command&.include?('%s')
custom_command % @file_path
elsif custom_command
"#{custom_command} #{options} #{@file_path}"
Expand Down

0 comments on commit c5c0886

Please sign in to comment.