Sha256: c18f0e923656d029bad08485d822f56014589f6d0d0e4dac07983209ff4a20dc

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

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
  module Template
    # Is responsible for compiling a template using the Amrita2 templating engine.

    class Amrita2 < Template

      ENGINES[self] = %w[ amrita amr ]

      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
          instance, params, file =
            action.instance, action.params, action.template
          raise_no_action(action) unless file

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

Version data entries

1 entries across 1 versions & 1 rubygems

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