Class: Puma::NullIO

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

Overview

Provides an IO-like object that always appears to contain no data. Used as the value for rack.input when the request has no body.

Instance Method Summary collapse

Instance Method Details

#closeObject

Does nothing



31
32
# File 'lib/puma/null_io.rb', line 31

def close
end

#eachObject

Never yields



15
16
# File 'lib/puma/null_io.rb', line 15

def each
end

#getsObject

Always returns nil



9
10
11
# File 'lib/puma/null_io.rb', line 9

def gets
  nil
end

#read(count = nil, buffer = nil) ⇒ Object

Mimics IO#read with no data



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

def read(count=nil,buffer=nil)
  (count && count > 0) ? nil : ""
end

#rewindObject

Does nothing



26
27
# File 'lib/puma/null_io.rb', line 26

def rewind
end