module AsyncPartial::CaptureHelper

Public Instance Methods

capture(*args, &block) click to toggle source
# File lib/async_partial.rb, line 46
def capture(*args, &block)
  buf = Thread.current[:output_buffers].last
  value = nil
  buffer = with_output_buffer(buf) { value = block.call(*args) }
  if (string = buffer.presence || value) && string.is_a?(String)
    ERB::Util.html_escape string
  end
end