Class: ConfigOMat::Op::CompileTemplates
- Inherits:
-
LifecycleVM::OpBase
- Object
- LifecycleVM::OpBase
- ConfigOMat::Op::CompileTemplates
- Defined in:
- lib/config_o_mat/configurator/op/compile_templates.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/config_o_mat/configurator/op/compile_templates.rb', line 27 def call self.compiled_templates = template_defs.each_with_object({}) do |(key, templ_def), hash| filename = File.join(configuration_directory, 'templates', templ_def.src) begin templ = ERB.new(File.read(filename), trim_mode: '<>') templ.filename = filename hash[key] = templ.def_class(Object, 'render(profiles)').new rescue SyntaxError, StandardError => e error filename, e end end end |