Class: Padrino::Helpers::OutputHelpers::ErbHandler
- Inherits:
-
AbstractHandler
- Object
- AbstractHandler
- Padrino::Helpers::OutputHelpers::ErbHandler
- Defined in:
- lib/padrino-helpers/output_helpers/erb_handler.rb
Overview
Handler for Erb template.
Instance Attribute Summary
Attributes inherited from AbstractHandler
Instance Method Summary collapse
-
#concat_to_template(text = "", context = nil) ⇒ Object
Outputs the given text to the templates buffer directly.
-
#engine_matches?(block) ⇒ Boolean
Returns true if the block is Erb.
Methods inherited from AbstractHandler
#capture_from_template, #initialize
Constructor Details
This class inherits a constructor from Padrino::Helpers::OutputHelpers::AbstractHandler
Instance Method Details
#concat_to_template(text = "", context = nil) ⇒ Object
Outputs the given text to the templates buffer directly.
11 12 13 14 15 |
# File 'lib/padrino-helpers/output_helpers/erb_handler.rb', line 11 def concat_to_template(text="", context=nil) return text if context && context.eval("@__in_ruby_literal") output_buffer << text nil end |
#engine_matches?(block) ⇒ Boolean
Returns true if the block is Erb.
20 21 22 |
# File 'lib/padrino-helpers/output_helpers/erb_handler.rb', line 20 def engine_matches?(block) block.binding.eval('defined? __in_erb_template') end |