Skip to content

Commit b387a21

Browse files
committed
Avoid JSON.load_file
The `.load_file` was added around 2020 and the JSON gem may not be updated on some systems.
1 parent fc25fdc commit b387a21

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

templatescompiler/erbrenderer/erb_renderer.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ def render(src_path, dst_path)
177177
erb = ERB.new(File.read(src_path), trim_mode: "-")
178178
erb.filename = src_path
179179

180-
context_hash = JSON.load_file(@json_context_path)
180+
# Note: JSON.load_file was added in v2.3.1: https://github.com/ruby/json/blob/v2.3.1/lib/json/common.rb#L286
181+
context_hash = JSON.parse(File.read(@json_context_path))
181182
template_evaluation_context = TemplateEvaluationContext.new(context_hash)
182183

183184
File.write(dst_path, erb.result(template_evaluation_context.get_binding))

0 commit comments

Comments
 (0)