From 9dc12ce6a3b898ce1bbd1e0891091341d81e6b95 Mon Sep 17 00:00:00 2001 From: jlkiri Date: Sun, 1 Jan 2023 21:44:36 +0900 Subject: [PATCH] Use named parameters in ERB.new function Since Ruby v3 the meaning of 2nd and 3rd parameters to ERB.new changed as well as the way the arguments should be passed. It requires a named 2nd parameter now. Also update Dockerfile ruby image version for local testing. --- .gitignore | 2 +- Dockerfile | 2 +- lib/consul/async/consul_template.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c6ea556..676dbd0 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,7 @@ samples/consul-ui/decorators.js /samples/hosts /samples/hosts_per_services /samples/prometheus_consul_coordinates -/samples/ready +/samples/consul-ui/ready /samples/render_template_from_kv /samples/consul_template /samples/metrics diff --git a/Dockerfile b/Dockerfile index e958254..df38077 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.5 +FROM ruby:3.2 WORKDIR /usr/src/app COPY . . diff --git a/lib/consul/async/consul_template.rb b/lib/consul/async/consul_template.rb index 82cfa3c..ef9dbb9 100644 --- a/lib/consul/async/consul_template.rb +++ b/lib/consul/async/consul_template.rb @@ -318,7 +318,7 @@ def render(tpl, tpl_file_path, params = {}, current_template_info: nil) params: params, template_info: tpl_info } - result = ERB.new(tpl, nil, @trim_mode).result(binding) + result = ERB.new(tpl, trim_mode: @trim_mode).result(binding) raise "Result is not a string :='#{result}' for #{tpl_file_path}" unless result.is_a?(String) @context = old_value