Module: Visionbundles::Helpers::Templates
- Defined in:
- lib/visionbundles/helpers/templates.rb
Instance Method Summary collapse
Instance Method Details
#from_template(file) ⇒ Object
5 6 7 8 9 |
# File 'lib/visionbundles/helpers/templates.rb', line 5 def from_template(file) abs_path = File.join(File.dirname(__FILE__), file) template = File.read(abs_path) ERB.new(template).result(binding) end |
#template(erb_source, to_dir, filename) ⇒ Object
11 12 13 14 15 |
# File 'lib/visionbundles/helpers/templates.rb', line 11 def template(erb_source, to_dir, filename) mkdir(to_dir) compiled_file = "#{to_dir}/#{filename}" put from_template(erb_source), compiled_file end |