Sha256: 9eb0f2680fd066f69f640a4fc1b6c0ec94605c66a2ff4264af39065380722e2c
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
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 'haml/engine' module Ramaze::Template class Haml < Template # Custom HAML-options for your controller to be merged. trait :haml_options => { :locals => {} } Ramaze::Controller.register_engine self, %w[ haml ] class << self # Transform any String via Haml, takes optionally an hash with the haml_options # that you can set also by # trait :haml_options => {} # if you pass the options it will merge the trait with them. (your options # override the defaults from trait[:haml_options] def transform controller, options = {} action, parameter, file, bound = *super reaction = controller.send(action, *parameter) template = reaction_or_file(reaction, file) return '' unless template haml = ::Haml::Engine.new(template, ancestral_trait[:haml_options]) haml.to_html(controller) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ramaze-0.0.8 | lib/ramaze/template/haml.rb |
ramaze-0.0.9 | lib/ramaze/template/haml.rb |
ramaze-0.1.0 | lib/ramaze/template/haml.rb |