# File lib/action_view/helpers/capture_helper.rb, line 51 def capture(*args, &block) # execute the block buffer = eval("_erbout", block.binding) 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