module DeepCover::Tools::RenderTemplate
Public Instance Methods
render_template(template, bound_object)
click to toggle source
# File lib/deep_cover/tools/render_template.rb, line 5 def render_template(template, bound_object) require 'erb' caller_path = Pathname.new(caller(1..1).first.partition(/\.rb:\d/).first).dirname template = caller_path.join("template/#{template}.html.erb").read erb = ERB.new(template) erb.result(bound_object.instance_eval { binding }) end