Sha256: 5c9e6c8ce9cc9f9e3eaced496db06a074ff297e174eee1c89740fd5d50275bf5
Contents?: true
Size: 766 Bytes
Versions: 5
Compression:
Stored size: 766 Bytes
Contents
require 'ostruct' module ExpressTemplates module Compiler def compile(template_or_src=nil, &block) if block begin block.source rescue raise "block must have source - did you do compile(&:label) ?" end end template, src = _normalize(template_or_src) %Q[Arbre::Context.new(assigns.merge(template_virtual_path: @virtual_path), self) { #{src || block.source_body} }.to_s] end private def _normalize(template_or_src) template, src = nil, nil if template_or_src.respond_to?(:source) template = template_or_src src = template_or_src.source else src = template_or_src end return template, src end end end
Version data entries
5 entries across 5 versions & 2 rubygems