Sha256: c94b9337797667ef7a42d62d00ea38129b7bc5347307e37637fb0aeddf1269b9

Contents?: true

Size: 939 Bytes

Versions: 1

Compression:

Stored size: 939 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

      ENGINES[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)

          instance = action.instance
          hash     = instance.instance_variable_get("@hash") || {}
          template = ::Liquid::Template.parse(template)
          options  = instance.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.2 lib/ramaze/template/liquid.rb