def capture_erb( *args, &block )
    # get the buffer from the block's binding
    buffer = _erb_buffer(block.binding) rescue nil
 
    # If there is no buffer, just call the block and get the contents
    if buffer.nil?
      block.call(*args)
    # If there is a buffer, execute the block, then extract its contents
    else
      pos = buffer.length
      block.call(*args)
 
      # extract the block
      data = buffer[pos..-1]
 
      # replace it in the original with empty string
      buffer[pos..-1] = ""
 
      data
    end
  end
def capture_erb( *args, &block )
    # get the buffer from the block's binding
    buffer = _erb_buffer(block.binding) rescue nil
 
    # If there is no buffer, just call the block and get the contents
    if buffer.nil?
      block.call(*args)
    # If there is a buffer, execute the block, then extract its contents
    else
      pos = buffer.length
      block.call(*args)
 
      # extract the block
      data = buffer[pos..-1]
 
      # replace it in the original with empty string
      buffer[pos..-1] = ""
 
      data
    end
  end
This method is used to capture content from an ERB filter evaluation. It
 is useful to helpers that need to process chunks of data during ERB filter
 processing.

 ==== Parameters
 *args:: Arguments to pass to the block.
 &block:: The ERB block to call.

 ==== Returns
 String:: The output of the block.

 ==== Examples
 Capture being used in an ERB page:

   <% @foo = capture_erb do %>
     <p>Some Foo content!</p>
   <% end %>