Class: Puma::IOBuffer
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
StringIO
|
|
Instance Chain:
self,
StringIO
|
|
Inherits: |
StringIO
|
Defined in: | lib/puma/io_buffer.rb |
Class Method Summary
- .new ⇒ IOBuffer constructor
Instance Attribute Summary
- #empty? ⇒ Boolean readonly
Instance Method Summary
- #append(*strs)
-
#clear
Alias for #reset.
-
#read_and_reset ⇒ String
Read & Reset - returns contents and resets.
- #reset (also: #clear)
- #to_s
Constructor Details
.new ⇒ IOBuffer
# File 'lib/puma/io_buffer.rb', line 7
def initialize super.binmode end
Instance Attribute Details
#empty? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/puma/io_buffer.rb', line 11
def empty? length.zero? end
Instance Method Details
#append(*strs)
[ GitHub ]# File 'lib/puma/io_buffer.rb', line 41
alias_method :append, :write
#clear
Alias for #reset.
# File 'lib/puma/io_buffer.rb', line 35
alias_method :clear, :reset
#read_and_reset ⇒ String
Read & Reset - returns contents and resets
# File 'lib/puma/io_buffer.rb', line 27
def read_and_reset rewind str = read truncate 0 rewind str end
#reset Also known as: #clear
[ GitHub ]# File 'lib/puma/io_buffer.rb', line 15
def reset truncate 0 rewind end
#to_s
[ GitHub ]# File 'lib/puma/io_buffer.rb', line 20
def to_s rewind read end