module Really::Helpers::RenderingHelper

Public Class Methods

render_template(path, context = binding) click to toggle source
# File lib/really/helpers/rendering_helper.rb, line 7
def render_template(path, context = binding)
  path = File.expand_path path
  raise "File at '#{path}' is not readable. (Does it exist?)" unless File.readable?(path)

  logger.debug "Rendering eRuby template at path '#{path}'..."

  eruby = Erubis::Eruby.new File.read(path)
  result = eruby.result context

  result
end