123456789_123456789_123456789_123456789_123456789_

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

Instance Attribute Summary

Instance Method Summary

Constructor Details

.newIOBuffer

[ GitHub ]

  
# 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.

[ GitHub ]

  
# File 'lib/puma/io_buffer.rb', line 35

alias_method :clear, :reset

#read_and_resetString

Read & Reset - returns contents and resets

Returns:

  • (String)

    StringIO contents

[ GitHub ]

  
# 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