AbstractHandler
Handler for reading and writing from an erb template.
Returns true if the block given is of the handler’s template type; false otherwise.
@example
@handler.block_is_type?(block) => true
# File lib/padrino-helpers/output_helpers/erb_handler.rb, line 55 def block_is_type?(block) is_type? || (block && eval('defined?(__in_erb_template)', block.binding)) end
Captures the html from a block of template code for this handler
@example
@handler.capture_from_template(&block) => "...html..."
# File lib/padrino-helpers/output_helpers/erb_handler.rb, line 30 def capture_from_template(*args, &block) self.output_buffer, _buf_was = "", self.output_buffer block.call(*args) ret = eval("@_out_buf", block.binding) self.output_buffer = _buf_was ret end
Outputs the given text to the templates buffer directly
@example
@handler.concat_to_template("This will be output to the template buffer")
# File lib/padrino-helpers/output_helpers/erb_handler.rb, line 44 def concat_to_template(text="") self.output_buffer << text if is_type? && text nil end
Generated with the Darkfish Rdoc Generator 2.