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_admin-1.6.4 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_templates-0.11.2 lib/express_templates/compiler.rb
express_admin-1.6.3 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_templates-0.11.1 lib/express_templates/compiler.rb
express_admin-1.6.2 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_admin-1.6.1 vendor/gems/express_templates/lib/express_templates/compiler.rb
express_templates-0.11.0 lib/express_templates/compiler.rb