Sha256: 1c16af19e0e50ea989eed607d0a5e9b720d6684e3440fd30675e2e77336d0b73

Contents?: true

Size: 998 Bytes

Versions: 1

Compression:

Stored size: 998 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 'amrita2/template'

module Ramaze::Template

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

  class Amrita2 < Template

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

    class << self

      # Takes an Action
      # The file is rendered using Amrita2::TemplateFile.
      # The Controller is used as the object for expansion.
      #
      # The parameters are set to @params in the controller before expansion.

      def transform action
        controller, params, file =
          action.controller, action.params, action.template
        raise_no_action(action) unless file

        template = ::Amrita2::TemplateFile.new(file)
        out = ''
        controller.instance_variable_set('@params', params)
        template.expand(out, controller)
        out
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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