class Erubi::CaptureBlockEngine::Buffer
Public Instance Methods
<<(v)
click to toggle source
Convert argument to string when concatening
# File lib/erubi/capture_block.rb 35 def <<(v) 36 concat(v.to_s) 37 end
capture(*args) { |*args| ... }
click to toggle source
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.
# 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
|(v)
click to toggle source
Escape argument using Erubi.h
then then concatenate it to the receiver.
# File lib/erubi/capture_block.rb 40 def |(v) 41 concat(h(v)) 42 end
Private Instance Methods
h(v)
click to toggle source
# File lib/erubi/capture_block.rb 62 def h(v) 63 ::Erubi.h(v) 64 end