# File lib/merb-core/controller/template.rb, line 161 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