Class: Propolize::StringBuffer

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

Overview

A very simple string buffer that maintains data as an array of strings and joins them all together when the final result is required.

Instance Method Summary collapse

Constructor Details

#initializeStringBuffer

Returns a new instance of StringBuffer.



92
93
94
# File 'lib/propolize.rb', line 92

def initialize
  @strings = []
end

Instance Method Details

#to_stringObject



100
101
102
# File 'lib/propolize.rb', line 100

def to_string
  return @strings.join("")
end

#write(string) ⇒ Object



96
97
98
# File 'lib/propolize.rb', line 96

def write(string)
  @strings.push(string)
end