Sha256: 1538216b706258315c58fa3c618359813d152aee139ee5bef0a5bbbccd66b3d7

Contents?: true

Size: 936 Bytes

Versions: 1

Compression:

Stored size: 936 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 'liquid'

module Ramaze
  module Template
    class Liquid < Template
      Controller.register_engine self, %w[ liquid ]

      class << self

        # initializes the handling of a request on the controller.
        # Creates a new instances of itself and sends the action and params.
        # Also tries to render the template.
        # In Theory you can use this standalone, this has not been tested though.

        def transform action
          template = reaction_or_file(action)

          hash     = action.controller.instance_variable_get("@hash") || {}
          template = ::Liquid::Template.parse(template)
          options  = action.controller.ancestral_trait[:liquid_options]

          template.render(hash, options)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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