Module: ExpressTemplates::Compiler

Included in:
ExpressTemplates
Defined in:
lib/express_templates/compiler.rb

Instance Method Summary collapse

Instance Method Details

#compile(template_or_src = nil, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/express_templates/compiler.rb', line 3

def compile(template_or_src=nil, &block)
  _, src = _normalize(template_or_src)

    # local_assigns = {} if !defined?(local_assigns)
    # merged_assigns = assigns.merge(template_virtual_path: @virtual_path)
    #                         .merge(local_assigns)
  # The following must be one-line otherwise we lose accurate
  # line reporting on the stack.
  %Q{Arbre::Context.new(assigns.merge(template_virtual_path: @virtual_path).merge(defined?(local_assigns) ? local_assigns : {}), self) { #{src || block.source_body} }.to_s}
end