class Twiddler::Rendering
Public Class Methods
new(config)
click to toggle source
# File lib/twiddler/rendering.rb, line 5 def initialize(config) @config = config end
Public Instance Methods
embed(name)
click to toggle source
# File lib/twiddler/rendering.rb, line 9 def embed(name) path = template_path(name) template = File::read(path) erb = ERB.new(template, nil, "%>") erb.filename = path mod = erb.def_module("render") @config.extend(mod) end
template_path(name)
click to toggle source
# File lib/twiddler/rendering.rb, line 18 def template_path(name) path = File::expand_path("../../templates/#{name}.erb", File::dirname(__FILE__)) end