Sha256: 3fe1dbcdb8e4f6b88191b66c9bc718d4a18e02ea83c972763e4e15878f76d1f5

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 Bytes

Contents

#          Copyright (c) 2006 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.

    class Erubis < Template

      ENGINES[self] = %w[ rhtml ]

      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 = ::Erubis::Eruby.new(template)
          eruby.init_evaluator(:filename => (action.template || __FILE__))
          eruby
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ramaze-0.1.2 lib/ramaze/template/erubis.rb