Class: IO::Stream::StringBuffer

Inherits:
String
  • Object
show all
Defined in:
lib/io/stream/string_buffer.rb

Constant Summary collapse

BINARY =
Encoding::BINARY

Instance Method Summary collapse

Constructor Details

#initializeStringBuffer

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