Sha256: f1edfe19a2a65aeff39e6dc7bcb923dbd98b276e2c643a018676cac1c9214e6d
Contents?: true
Size: 695 Bytes
Versions: 3
Compression:
Stored size: 695 Bytes
Contents
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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
brakeman-2.0.0 | lib/brakeman/report/renderer.rb |
brakeman-2.0.0.pre2 | lib/brakeman/report/renderer.rb |
brakeman-1.9.5 | lib/brakeman/report/renderer.rb |