W3cubDocs

/Padrino

Class: Padrino::Helpers::OutputHelpers::AbstractHandler

Inherits:
Object
  • Object

Direct Known Subclasses

ErbHandler, HamlHandler, HamlitHandler, SlimHandler

Instance Attribute Summary

Instance Method Summary

Constructor Details

#initialize(template) ⇒ AbstractHandler

Returns a new instance of AbstractHandler

Instance Attribute Details

#output_buffer ⇒ Object

Returns the value of attribute output_buffer

#template ⇒ Object (readonly)

Returns the value of attribute template

Instance Method Details

#capture_from_template(*args, &block) ⇒ Object

Captures the html from a block of template code for this handler.

This method is called to capture content of a block-loving helpers in templates. Haml has a special method to do this, for Erb and Slim we save original buffer, call the block and then restore the buffer.

Examples:

@handler.capture_from_template(&block) => "...html..."

#concat_to_template(text = "", context = nil) ⇒ Object

Outputs the given text to the template.

This method is called when template uses block-aware helpers. For Slim and Haml such helpers just return output to use with `=`. For Erb this method is implemented in ErbHandler by concatenating given text to output buffer.

Examples:

@handler.concat_to_template("This will be output to the template buffer")

#engine_matches?(block) ⇒ Boolean

Returns true if the block given is of the handler's template type; false otherwise.

Examples:

@handler.engine_matches?(block) => true

Returns:

  • (Boolean)