Class: Puma::IOBuffer

Inherits:
StringIO
  • Object
show all
Defined in:
lib/puma/io_buffer.rb

Instance Method Summary collapse

Constructor Details

#initializeIOBuffer



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_resetString

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

#resetObject Also known as: clear



15
16
17
18
# File 'lib/puma/io_buffer.rb', line 15

def reset
  truncate 0
  rewind
end

#to_sObject



20
21
22
23
# File 'lib/puma/io_buffer.rb', line 20

def to_s
  rewind
  read
end