From ee25ccfdbc634191c9d5cf100f59ef91e52c14fb Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 13 Jun 2023 02:12:57 -0400 Subject: [PATCH] Fix Ruby 3.1 deprecation warning with ERB.new (#1108) * Fix Ruby 3.1 deprecation warning with ERB.new This eliminates the warning: ``` warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead. ``` Per https://bugs.ruby-lang.org/issues/14256, `trim_mode` needs to be a keyword argument. This is compatible with Ruby 2.7 and on. Signed-off-by: Stan Hu * Remove safe_level argument as it's deprecated too Signed-off-by: Vikram Karve --------- Signed-off-by: Stan Hu Signed-off-by: Vikram Karve Co-authored-by: Vikram Karve <85881329+vkarve-chef@users.noreply.github.com> --- lib/omnibus/templating.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/omnibus/templating.rb b/lib/omnibus/templating.rb index 47016cd70..d6b454d95 100644 --- a/lib/omnibus/templating.rb +++ b/lib/omnibus/templating.rb @@ -36,8 +36,7 @@ def self.included(base) # the list of variables to pass to the template # def render_template_content(source, variables = {}) - template = ERB.new(File.read(source), nil, "-") - + template = ERB.new(File.read(source), trim_mode: "-") struct = if variables.empty? Struct.new("Empty")