Class: ZRB::Buffer

Inherits:
String
  • Object
show all
Defined in:
lib/zrb.rb

Direct Known Subclasses

HTMLBuffer

Instance Method Summary collapse

Instance Method Details

#capture(blk, *args) ⇒ Object



171
172
173
174
175
176
# File 'lib/zrb.rb', line 171

def capture(blk, *args)
  start = self.size
  blk.call(*args)
ensure
  return self.slice!(start..-1)
end

#escape(other) ⇒ Object



163
164
165
# File 'lib/zrb.rb', line 163

def escape(other)
  other.to_s
end

#safe_append=(other) ⇒ Object



167
168
169
# File 'lib/zrb.rb', line 167

def safe_append=(other)
  self << escape(other)
end