Class: Padrino::Helpers::OutputHelpers::HamlHandler
- Inherits:
-
AbstractHandler
- Object
- AbstractHandler
- Padrino::Helpers::OutputHelpers::HamlHandler
- Defined in:
- lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/haml_handler.rb
Overview
Handler for reading and writing from a haml template.
Instance Attribute Summary
Attributes inherited from AbstractHandler
Instance Method Summary collapse
-
#block_is_type?(block) ⇒ Boolean
Returns true if the block given is of the handler’s template type; false otherwise.
-
#capture_from_template(*args, &block) ⇒ Object
Captures the html from a block of template code for this handler.
-
#concat_to_template(text = "") ⇒ Object
Outputs the given text to the templates buffer directly.
-
#engines ⇒ Object
Returns an array of engines used for the template.
-
#is_type? ⇒ Boolean
Returns true if the current template type is same as this handlers; false otherwise.
Methods inherited from AbstractHandler
#initialize, #template_extension
Constructor Details
This class inherits a constructor from Padrino::Helpers::OutputHelpers::AbstractHandler
Instance Method Details
#block_is_type?(block) ⇒ Boolean
Returns true if the block given is of the handler’s template type; false otherwise.
24 25 26 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/haml_handler.rb', line 24 def block_is_type?(block) template.block_is_haml?(block) end |
#capture_from_template(*args, &block) ⇒ Object
Captures the html from a block of template code for this handler
33 34 35 36 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/haml_handler.rb', line 33 def capture_from_template(*args, &block) eval("_hamlout ||= @haml_buffer", block.binding) # this is for rbx template.capture_haml(*args, &block) end |
#concat_to_template(text = "") ⇒ Object
Outputs the given text to the templates buffer directly
44 45 46 47 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/haml_handler.rb', line 44 def concat_to_template(text="") template.haml_concat(text) nil end |
#engines ⇒ Object
Returns an array of engines used for the template
55 56 57 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/haml_handler.rb', line 55 def engines @_engines ||= [:haml] end |
#is_type? ⇒ Boolean
Returns true if the current template type is same as this handlers; false otherwise.
14 15 16 |
# File 'lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/output_helpers/haml_handler.rb', line 14 def is_type? template.respond_to?(:is_haml?) && template.is_haml? end |