Module: Ki::Middleware::Helpers::HamlCompiler
- Included in:
- KiApp
- Defined in:
- lib/ki/middleware/helpers/haml_compiler_helper.rb
Instance Method Summary collapse
Instance Method Details
#render_haml(s) ⇒ Object
23 24 25 |
# File 'lib/ki/middleware/helpers/haml_compiler_helper.rb', line 23 def render_haml(s) Haml::Engine.new("- extend Ki::Helpers\n" + s) end |
#render_haml_file(file_path, layout = true) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ki/middleware/helpers/haml_compiler_helper.rb', line 7 def render_haml_file(file_path, layout = true) file_contents = File.read(file_path) layout_contents = if layout && view_exists?('layout') File.read(view_path('layout')) else '= yield' end html = render_haml(layout_contents).render do render_haml(file_contents).render end html end |