class Conjur::WebServer::Renderer
a helper class to render HTML partials
Attributes
files[R]
Public Class Methods
new(root)
click to toggle source
# File lib/conjur/webserver/renderer.rb, line 5 def initialize root @root = root @files = [] end
Public Instance Methods
render(template)
click to toggle source
# File lib/conjur/webserver/renderer.rb, line 12 def render template ERB.new(template).result binding end
Private Instance Methods
expand_path(filename)
click to toggle source
# File lib/conjur/webserver/renderer.rb, line 29 def expand_path filename File.expand_path(filename, @root) end
method_missing(name, *a, &b)
click to toggle source
Calls superclass method
# File lib/conjur/webserver/renderer.rb, line 18 def method_missing name, *a, &b super if !a.empty? || block_given? # try to load fragments path = expand_path "_#{name}.html" super unless File.exists? path @files << path File.read path end