Class: BootstrapEmail::Erb

Inherits:
Object
  • Object
show all
Defined in:
lib/bootstrap-email/erb.rb

Class Method Summary collapse

Class Method Details

.template(path, locals_hash = {}) ⇒ Object



3
4
5
6
7
# File 'lib/bootstrap-email/erb.rb', line 3

def self.template(path, locals_hash = {})
  namespace = OpenStruct.new(locals_hash)
  template_html = File.read(path)
  ERB.new(template_html).result(namespace.instance_eval { binding })
end