Method: Linecook::Recipe#capture

Defined in:
lib/linecook/recipe.rb

#capture(target = "") ⇒ Object

Captures writes during the block to a new target. Returns the target.



224
225
226
227
228
229
230
231
232
233
# File 'lib/linecook/recipe.rb', line 224

def capture(target = "")
  current = @target
  begin
    @target = target
    yield
  ensure
    @target = current
  end
  target
end