Sha256: 87904a8b2214b594cf1f1653bf55b9b5a7217c3ef5180ca9ebfb3c253224fc8e

Contents?: true

Size: 1.05 KB

Versions: 22

Compression:

Stored size: 1.05 KB

Contents

#          Copyright (c) 2008 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

    # Is responsible for compiling a template using the Liquid templating engine.
    # Can be found at: http://home.leetsoft.com/liquid

    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

22 entries across 22 versions & 5 rubygems

Version Path
Pistos-ramaze-2008.09 lib/ramaze/template/liquid.rb
Pistos-ramaze-2008.12 lib/ramaze/template/liquid.rb
Pistos-ramaze-2009.01 lib/ramaze/template/liquid.rb
Pistos-ramaze-2009.02 lib/ramaze/template/liquid.rb
clivecrous-ramaze-0.3.9.5 lib/ramaze/template/liquid.rb
manveru-ramaze-2008.07 lib/ramaze/template/liquid.rb
manveru-ramaze-2008.08 lib/ramaze/template/liquid.rb
manveru-ramaze-2008.09 lib/ramaze/template/liquid.rb
manveru-ramaze-2008.10 lib/ramaze/template/liquid.rb
manveru-ramaze-2008.12 lib/ramaze/template/liquid.rb
manveru-ramaze-2009.01 lib/ramaze/template/liquid.rb
ptomato-ramaze-2009.02.1 lib/ramaze/template/liquid.rb
ptomato-ramaze-2009.02 lib/ramaze/template/liquid.rb
ramaze-0.3.5 lib/ramaze/template/liquid.rb
ramaze-0.3.0 lib/ramaze/template/liquid.rb
ramaze-2008.06 lib/ramaze/template/liquid.rb
ramaze-0.3.9.1 lib/ramaze/template/liquid.rb
ramaze-2009.01 lib/ramaze/template/liquid.rb
ramaze-2008.11 lib/ramaze/template/liquid.rb
ramaze-0.3.9 lib/ramaze/template/liquid.rb