Class: Liquidscript::Buffer
- Inherits:
-
Object
- Object
- Liquidscript::Buffer
- Defined in:
- lib/liquidscript/buffer.rb
Instance Method Summary collapse
- #append(*a) ⇒ Object (also: #<<, #push)
-
#initialize(*args) ⇒ Buffer
constructor
A new instance of Buffer.
- #inspect ⇒ Object
- #set_join!(to) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ Buffer
Returns a new instance of Buffer.
4 5 6 7 8 |
# File 'lib/liquidscript/buffer.rb', line 4 def initialize(*args) @_buf = args @_cache = nil @_join = '' end |
Instance Method Details
#append(*a) ⇒ Object Also known as: <<, push
10 11 12 13 14 |
# File 'lib/liquidscript/buffer.rb', line 10 def append(*a) @_cache = nil @_buf.push(*a) self end |
#inspect ⇒ Object
29 30 31 |
# File 'lib/liquidscript/buffer.rb', line 29 def inspect to_s.inspect end |
#set_join!(to) ⇒ Object
16 17 18 |
# File 'lib/liquidscript/buffer.rb', line 16 def set_join!(to) @_join = to end |
#to_s ⇒ Object
23 24 25 26 27 |
# File 'lib/liquidscript/buffer.rb', line 23 def to_s @_cache ||= begin @_buf.join @_join end end |