Sha256: 10ade6cbe626ef1eca4fe3e2029355291722efd31f3f6e89184aecf03812e5b6
Contents?: true
Size: 710 Bytes
Versions: 275
Compression:
Stored size: 710 Bytes
Contents
require 'erb' class Brakeman::Report class Renderer def initialize(template_file, hash = {}) hash[:locals] ||= {} singleton = class << self; self end hash[:locals].each do |attribute_name, attribute_value| singleton.send(:define_method, attribute_name) { attribute_value } end # There are last, so as to make overwriting these using locals impossible. singleton.send(:define_method, 'template_file') { template_file } singleton.send(:define_method, 'template') { File.read(File.expand_path("templates/#{template_file}.html.erb", File.dirname(__FILE__))) } end def render ERB.new(template).result(binding) end end end
Version data entries
275 entries across 261 versions & 4 rubygems