Class: Vessel::Templator
- Inherits:
-
Object
- Object
- Vessel::Templator
- Defined in:
- lib/vessel/templator.rb
Constant Summary collapse
- TEMPLATES =
"templates/*.erb"
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(domain, options) ⇒ Templator
constructor
A new instance of Templator.
Constructor Details
#initialize(domain, options) ⇒ Templator
Returns a new instance of Templator.
7 8 9 10 11 |
# File 'lib/vessel/templator.rb', line 7 def initialize(domain, ) @domain = domain @options = @class_name = @domain.gsub("-", ".dash.").split(".").map(&:capitalize).join end |
Instance Method Details
#build ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/vessel/templator.rb', line 13 def build abort "Template #{template_path} not found" unless File.file?(template_path) file = File.read(template_path) evaluated = ERB.new(file).result(binding) Logger.debug("Templator: creating file #{store_path}") File.write(store_path, evaluated) end |