Class: Tina4::Template::ErbEngine
- Inherits:
-
Object
- Object
- Tina4::Template::ErbEngine
- Defined in:
- lib/tina4/template.rb
Class Method Summary collapse
Class Method Details
.create_binding(context) ⇒ Object
789 790 791 792 793 794 795 |
# File 'lib/tina4/template.rb', line 789 def self.create_binding(context) b = binding context.each do |key, value| b.local_variable_set(key.to_sym, value) end b end |
.render(content, context) ⇒ Object
783 784 785 786 787 |
# File 'lib/tina4/template.rb', line 783 def self.render(content, context) require "erb" binding_obj = create_binding(context) ERB.new(content, trim_mode: "-").result(binding_obj) end |