File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
13# At this point, we insert a placeholder since it will be up
24# to the backend to create a specific link.
35
6+ require "erb"
7+ require "pathname"
8+
9+ # collection of functions that can be used inside ERB templates
410module TemplateHelpers
511 # Insert a hyperlink to an extension.
612 # @param name [#to_s] Name of the extension
@@ -65,4 +71,12 @@ def anchor_for_csr(name)
6571 def anchor_for_csr_field ( csr_name , field_name )
6672 "[[csr_field-#{ csr_name . gsub ( "." , "_" ) } -#{ field_name . gsub ( "." , "_" ) } -def]]"
6773 end
68- end
74+
75+ def render ( template_path , locals = { } )
76+ template_path = Pathname . new ( template_path )
77+ erb = ERB . new ( template )
78+ erb . filename = template_path . realpath
79+
80+ erb . result ( OpenStruct . new ( locals ) . instance_eval { binding } )
81+ end
82+ end
You can’t perform that action at this time.
0 commit comments