Sha256: c513366289b399ee2c6857d520fdbc8224722ab4ba3fc449060a68310342b92f

Contents?: true

Size: 596 Bytes

Versions: 27

Compression:

Stored size: 596 Bytes

Contents

module ExpressTemplates
  module Compiler
    def compile(template_or_src=nil, &block)

      template, src = _normalize(template_or_src)

      %Q[assigns.merge!(template_virtual_path: @virtual_path) ; Arbre::Context.new(assigns, 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

27 entries across 27 versions & 2 rubygems

Version Path
express_templates-0.11.10 lib/express_templates/compiler.rb
express_templates-0.11.9 lib/express_templates/compiler.rb
express_templates-0.11.8 lib/express_templates/compiler.rb
express_templates-0.11.7 lib/express_templates/compiler.rb
express_templates-0.11.6 lib/express_templates/compiler.rb
express_templates-0.11.5 lib/express_templates/compiler.rb
express_templates-0.11.4 lib/express_templates/compiler.rb
express_admin-1.7.5 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.7.4 vendor/gems/express_templates/express_templates/lib/express_templates/compiler.rb
express_admin-1.7.3 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.7.2 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.7.1 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.6.13 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.6.12 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.6.11 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.6.10 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.6.9 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.6.8 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.6.7 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_templates-0.11.3 lib/express_templates/compiler.rb