Module: Gnarly::Haml
- Included in:
- Environment
- Defined in:
- lib/gnarly/haml.rb
Instance Method Summary collapse
Instance Method Details
#haml(name, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gnarly/haml.rb', line 7 def haml(name, &block) root = application.haml_root template = File.read "#{root}/#{name}.haml" template.force_encoding "utf-8" engine = ::Haml::Engine.new template body = engine.render self if block push_default_content_type "text/html" result = block.call body pop_default_content_type result else body end end |