lib/review/template.rb in review-5.0.0 vs lib/review/template.rb in review-5.1.0
- old
+ new
@@ -8,11 +8,17 @@
def self.load(filename, mode = 1)
self.new(filename, mode)
end
+ def self.generate(path:, binding:, mode: 1, template_dir: ReVIEW::Template::TEMPLATE_DIR)
+ template_file = File.expand_path(path, template_dir)
+ self.new(template_file, mode).result(binding)
+ end
+
def initialize(filename = nil, mode = nil)
return unless filename
+
content = File.read(filename)
@erb = ERB.new(content, nil, mode)
end
def result(bind_data = nil)