module Railspack::TemplateHelper
Public Class Methods
get_from_file(template_name)
click to toggle source
Given a template_name, looks in the templates/ directory and returns the contents of the file.
# File lib/railspack/template_helper.rb, line 5 def self.get_from_file(template_name) template_path = File.join(File.dirname(__FILE__), 'templates', template_name) file = File.open(template_path, "rb") contents = file.read end
render(template_name, locals)
click to toggle source
# File lib/railspack/template_helper.rb, line 11 def self.render(template_name, locals) contents = TemplateHelper.get_from_file(template_name) Erubis::Eruby.new(contents).result(locals) end