class Erubi::CaptureBlockEngine::Buffer
Public Instance Methods
Source
# File lib/erubi/capture_block.rb 35 def <<(v) 36 concat(v.to_s) 37 end
Convert argument to string when concatening
Source
# File lib/erubi/capture_block.rb 40 def |(v) 41 concat(h(v)) 42 end
Escape argument using Erubi.h
then then concatenate it to the receiver.
Source
# File lib/erubi/capture_block.rb 47 def capture(*args) 48 prev = dup 49 replace("") # 1.8 support! 50 yield(*args) 51 dup 52 ensure 53 replace(prev) 54 end
Temporarily clear the receiver before yielding to the block, yield the given args to the block, return any data captured by the receiver, and restore the original data the receiver contained before returning.