Sha256: 27970f7fcc60d7c93792fcadfc2786875d8e107258fcdc0fb0e1bfc10c0cb051

Contents?: true

Size: 713 Bytes

Versions: 3

Compression:

Stored size: 713 Bytes

Contents

require 'haml/util'
require 'haml/engine'

module Ramaze
  module View
    ##
    # View adapter that allows views to use Haml, for more information see the
    # following website: http://haml-lang.com/
    #
    module Haml
      def self.call(action, string)
        options = action.options

        if haml_options = action.instance.ancestral_trait[:haml_options]
          options = options.merge(haml_options)
        end

        action.options[:filename] = (action.view || '(haml)')
        haml = View.compile(string){|s| ::Haml::Engine.new(s, options) }
        html = haml.to_html(action.instance, action.variables)

        return html, 'text/html'
      end
    end # Haml
  end # View
end # Ramaze

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-2011.12.28 lib/ramaze/view/haml.rb
ramaze-2011.10.23 lib/ramaze/view/haml.rb
ramaze-2011.07.25 lib/ramaze/view/haml.rb