Skip to content

Commit

Permalink
Use named parameters in ERB.new function
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jlkiri committed Jan 1, 2023
1 parent 0fe8a79 commit 9dc12ce
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.5
FROM ruby:3.2

WORKDIR /usr/src/app
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion lib/consul/async/consul_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9dc12ce

Please sign in to comment.