Sha256: 4bf6bc0ba441c952c0c3ddcf8f57ce2a833fb0d53d58579ac47fcf9b02be3026

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 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::Template

  # Is responsible for compiling a template using the Erubis templating engine.

  class Erubis < Template

    Ramaze::Controller.register_engine self, %w[ rhtml ]

    class << self

      # Takes a controller and the options :action, :parameter, :file and :binding
      #
      # Builds a template out of the method on the controller and the
      # template-file.

      def transform action
        template = reaction_or_file(action)

        eruby = ::Erubis::Eruby.new(template)
        eruby.init_evaluator(:filename => (action.template || __FILE__))
        eruby.result(action.binding)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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