Sha256: 9c1e019603852e6a86fb833ab875dc33303bb1fb8b1cbdfb7fab6db5f2f3f7de

Contents?: true

Size: 1.13 KB

Versions: 18

Compression:

Stored size: 1.13 KB

Contents

#          Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require 'erubis'

module Ramaze
  module Template

    # Is responsible for compiling a template using the Erubis templating engine.
    # Can be found at: http://rubyforge.org/projects/erubis

    class Erubis < Template

      ENGINES[self] = %w[ rhtml ]

      # Allow for swapping in a differnt Erubis engine (it supplies several) and
      # passing options to the engine.
      trait[:engine] ||= ::Erubis::Eruby
      trait[:options] ||= {}

      class << self

        # Entry-point for Action#render

        def transform action
          eruby = wrap_compile(action)
          eruby.result(action.binding)
        end

        # Creates an instance of ::Erubis::Eruby, sets the filename
        # from the template and returns the instance.

        def compile(action, template)
          eruby = ancestral_trait[:engine].new(template, ancestral_trait[:options])
          eruby.init_evaluator(:filename => (action.template || __FILE__))
          eruby
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 5 rubygems

Version Path
Pistos-ramaze-2008.09 lib/ramaze/template/erubis.rb
Pistos-ramaze-2008.12 lib/ramaze/template/erubis.rb
Pistos-ramaze-2009.01 lib/ramaze/template/erubis.rb
Pistos-ramaze-2009.02 lib/ramaze/template/erubis.rb
clivecrous-ramaze-0.3.9.5 lib/ramaze/template/erubis.rb
manveru-ramaze-2008.07 lib/ramaze/template/erubis.rb
manveru-ramaze-2008.08 lib/ramaze/template/erubis.rb
manveru-ramaze-2008.09 lib/ramaze/template/erubis.rb
manveru-ramaze-2008.10 lib/ramaze/template/erubis.rb
manveru-ramaze-2008.12 lib/ramaze/template/erubis.rb
manveru-ramaze-2009.01 lib/ramaze/template/erubis.rb
ptomato-ramaze-2009.02.1 lib/ramaze/template/erubis.rb
ptomato-ramaze-2009.02 lib/ramaze/template/erubis.rb
ramaze-2008.06 lib/ramaze/template/erubis.rb
ramaze-2009.01 lib/ramaze/template/erubis.rb
ramaze-2008.11 lib/ramaze/template/erubis.rb
ramaze-2009.03 lib/ramaze/template/erubis.rb
ramaze-2009.02 lib/ramaze/template/erubis.rb