lib/omnibus/templating.rb
def render_template_content(source, variables = {})
      template = ERB.new(File.read(source), nil, "-")

      struct =
        if variables.empty?
          Struct.new("Empty")
        else
          Struct.new(*variables.keys).new(*variables.values)
        end

      template.result(struct.instance_eval { binding })
    end
def render_template_content(source, variables = {})
      template = ERB.new(File.read(source), nil, "-")

      struct =
        if variables.empty?
          Struct.new("Empty")
        else
          Struct.new(*variables.keys).new(*variables.values)
        end

      template.result(struct.instance_eval { binding })
    end
Render an erb template to a String variable.

 @return [String]

 @param [String] source
   the path on disk where the ERB template lives

 @option options [Fixnum] :mode (default: +0644+)
   the mode of the rendered file
 @option options [Hash] :variables (default: +{}+)
   the list of variables to pass to the template