Class: Propolize::StringBuffer
- Inherits:
-
Object
- Object
- Propolize::StringBuffer
- 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
-
#initialize ⇒ StringBuffer
constructor
A new instance of StringBuffer.
- #to_string ⇒ Object
- #write(string) ⇒ Object
Constructor Details
#initialize ⇒ StringBuffer
Returns a new instance of StringBuffer.
92 93 94 |
# File 'lib/propolize.rb', line 92 def initialize @strings = [] end |
Instance Method Details
#to_string ⇒ Object
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 |