# File lib/action_view/helpers/capture_helper.rb, line 33 def capture(*args, &block) # Return captured buffer in erb. if block_called_from_erb?(block) with_output_buffer { block.call(*args) } else # Return block result otherwise, but protect buffer also. with_output_buffer { return block.call(*args) } end end