Class: Prmd::Template
- Inherits:
-
Object
- Object
- Prmd::Template
- Defined in:
- lib/prmd/template.rb
Class Method Summary collapse
Class Method Details
.load(path, base) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/prmd/template.rb', line 3 def self.load(path, base) fallback = File.(File.join(File.dirname(__FILE__), 'templates')) resolved = File.join(base, path) if not File.exist?(resolved) resolved = File.join(fallback, path) end return File.read(resolved) end |
.render(path, base, *args) ⇒ Object
14 15 16 17 |
# File 'lib/prmd/template.rb', line 14 def self.render(path, base, *args) template = self.load(path, base) Erubis::Eruby.new(template).result(*args) end |