module RedmineCLI::TemplateRenderer
Renders templates
Public Class Methods
render(template, variables = {})
click to toggle source
finds template and renders it
@param template [String, Symbol] name of template. Use 'dir1/dir2/name' means assets/templates/dir1/dir2/name.erb
# File lib/redmine_cli/template_renderer.rb, line 18 def self.render(template, variables = {}) path = File.expand_path(template.to_s, @template_directory) + '.erb' fail "Template not found: #{path}" unless File.exist? path ErbEnvironment.new(File.read(path), variables).render end