Method: OpenC3::ConfigParser#render

Defined in:
lib/openc3/config/config_parser.rb

#render(template_name, options = {}) ⇒ Object

Called by the ERB template to render a partial

Raises:



161
162
163
164
165
166
167
168
169
170
# File 'lib/openc3/config/config_parser.rb', line 161

def render(template_name, options = {})
  raise Error.new(self, "Partial name '#{template_name}' must begin with an underscore.") if File.basename(template_name)[0] != '_'

  b = binding
  if options[:locals]
    options[:locals].each { |key, value| b.local_variable_set(key, value) }
  end

  return ERB.new(read_file(template_name), trim_mode: "-").result(b)
end