Skip to content

Commit

Permalink
Update capture per review
Browse files Browse the repository at this point in the history
  • Loading branch information
jkowens committed Dec 8, 2018
1 parent 5913bec commit a3339e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sinatra-contrib/lib/sinatra/capture.rb
Expand Up @@ -97,7 +97,9 @@ def capture(*args, &block)
result = block[*args]
elsif current_engine == :erb || current_engine == :slim
@_out_buf, _buf_was = '', @_out_buf
result = block.call(*args)
raw = block.call(*args)
captured = block.binding.eval('@_out_buf')
result = captured.empty? ? raw : captured
@_out_buf = _buf_was
else
buffer = eval '_buf if defined?(_buf)', block.binding
Expand Down

0 comments on commit a3339e0

Please sign in to comment.