class Padrino::Helpers::OutputHelpers::AbstractHandler

def capture_from_template(*args, &block)


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

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

Captures the html from a block of template code for this handler.
#
def capture_from_template(*args, &block)
  self.output_buffer, _buf_was = ActiveSupport::SafeBuffer.new, self.output_buffer
  raw = block.call(*args)
  captured = template.instance_variable_get(:@_out_buf)
  self.output_buffer = _buf_was
  engine_matches?(block) ? captured : raw
end

def concat_to_template(text="")


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

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

Outputs the given text to the template.
#
def concat_to_template(text="")
  text
end

def engine_matches?(block)


@handler.engine_matches?(block) => true
@example

Returns true if the block given is of the handler's template type; false otherwise.
#
def engine_matches?(block)
end

def initialize(template)

def initialize(template)
  @template = template
  @output_buffer = template.instance_variable_get(:@_out_buf)
end

def output_buffer=(val)

def output_buffer=(val)
  template.instance_variable_set(:@_out_buf, val)
end