Class: Padrino::Helpers::OutputHelpers::ErbHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/middleman-core/core_extensions/default_helpers.rb

Instance Method Summary collapse

Instance Method Details

#capture_from_template(*args, &block) ⇒ Object

Force Erb capture not to use safebuffer


17
18
19
20
21
22
23
24
# File 'lib/middleman-core/core_extensions/default_helpers.rb', line 17

def capture_from_template(*args, &block)
  self.output_buffer = ''
  buf_was = output_buffer
  raw = yield(*args)
  captured = template.instance_variable_get(:@_out_buf)
  self.output_buffer = buf_was
  engine_matches?(block) && !captured.empty? ? captured : raw
end