module Conjur module WebServer # a helper class to render HTML partials class Renderer def initialize root @root = root @files = [] end attr_reader :files def render template ERB.new(template).result binding end private 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 def expand_path filename File.expand_path(filename, @root) end end end end