Sha256: c17fa3e49e3aad6d39f5719d6f6206c724e21835e849ce09d71d1589377d83ac

Contents?: true

Size: 1023 Bytes

Versions: 4

Compression:

Stored size: 1023 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 'remarkably/engines/html'

module Ramaze
  module Template

    # Is responsible for compiling a template using the Remarkably templating engine.
    # Can be found at: http://rubyforge.org/projects/remarkably

    class Remarkably < Template
      ENGINES[self] = %w[ rem ]

      class << self

        # Entry point for Action#render

        def transform action
          result, file = result_and_file(action)

          result = transform_string(file, action) if file
          result.to_s
        end

        # Takes a string and action, sets args to action.args and then proceeds
        # to instance_eval the string inside the action.instance

        def transform_string(string, action)
          action.instance.instance_eval do
            args = action.params
            instance_eval(string)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ramaze-0.1.3 lib/ramaze/template/remarkably.rb
ramaze-0.1.4 lib/ramaze/template/remarkably.rb
ramaze-0.2.1 lib/ramaze/template/remarkably.rb
ramaze-0.2.0 lib/ramaze/template/remarkably.rb