Class: IO::Stream::StringBuffer
- Inherits:
-
String
- Object
- String
- IO::Stream::StringBuffer
- Defined in:
- lib/io/stream/string_buffer.rb
Constant Summary collapse
- BINARY =
Encoding::BINARY
Instance Method Summary collapse
- #<<(string) ⇒ Object (also: #concat)
-
#initialize ⇒ StringBuffer
constructor
A new instance of StringBuffer.
Constructor Details
#initialize ⇒ StringBuffer
Returns a new instance of StringBuffer.
10 11 12 13 14 |
# File 'lib/io/stream/string_buffer.rb', line 10 def initialize super force_encoding(BINARY) end |
Instance Method Details
#<<(string) ⇒ Object Also known as: concat
16 17 18 19 20 21 22 23 24 |
# File 'lib/io/stream/string_buffer.rb', line 16 def << string if string.encoding == BINARY super(string) else super(string.b) end return self end |