Class: SC::RenderEngine::Haml
- Inherits:
-
Object
- Object
- SC::RenderEngine::Haml
- Defined in:
- lib/sproutcore/render_engines/haml.rb
Instance Method Summary collapse
- #capture(*args, &block) ⇒ Object
- #compile(input) ⇒ Object
- #concat(string, binding) ⇒ Object
-
#initialize(html_context) ⇒ Haml
constructor
A new instance of Haml.
Constructor Details
#initialize(html_context) ⇒ Haml
Returns a new instance of Haml.
12 13 14 |
# File 'lib/sproutcore/render_engines/haml.rb', line 12 def initialize(html_context) @html_context = html_context end |
Instance Method Details
#capture(*args, &block) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/sproutcore/render_engines/haml.rb', line 29 def capture(*args, &block) if @html_context.respond_to?(:is_haml?) && @html_context.is_haml? @html_context.capture_haml(nil, &block) else block.call(*args).to_s end end |
#compile(input) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/sproutcore/render_engines/haml.rb', line 16 def compile(input) begin require 'haml' rescue raise "Cannot render HAML file because haml is not installed. Try running 'sudo gem install haml' and try again" end ::Haml::Engine.new(input).send(:precompiled_with_ambles, []) end |
#concat(string, binding) ⇒ Object
25 26 27 |
# File 'lib/sproutcore/render_engines/haml.rb', line 25 def concat(string, binding) eval("_hamlout", binding).push_text string end |