Class: Puma::IOBuffer
- Inherits:
-
StringIO
- Object
- StringIO
- Puma::IOBuffer
- Defined in:
- lib/puma/io_buffer.rb
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize ⇒ IOBuffer
constructor
A new instance of IOBuffer.
-
#read_and_reset ⇒ String
Read & Reset - returns contents and resets.
- #reset ⇒ Object (also: #clear)
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ IOBuffer
Returns a new instance of IOBuffer.
7 8 9 |
# File 'lib/puma/io_buffer.rb', line 7 def initialize super.binmode end |
Instance Method Details
#empty? ⇒ Boolean
11 12 13 |
# File 'lib/puma/io_buffer.rb', line 11 def empty? length.zero? end |
#read_and_reset ⇒ String
Read & Reset - returns contents and resets
27 28 29 30 31 32 33 |
# File 'lib/puma/io_buffer.rb', line 27 def read_and_reset rewind str = read truncate 0 rewind str end |
#reset ⇒ Object Also known as: clear
15 16 17 18 |
# File 'lib/puma/io_buffer.rb', line 15 def reset truncate 0 rewind end |
#to_s ⇒ Object
20 21 22 23 |
# File 'lib/puma/io_buffer.rb', line 20 def to_s rewind read end |