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

#puts(*ary) ⇒ Object



43
44
# File 'lib/puma/null_io.rb', line 43

def puts(*ary)
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

#sizeObject

Always zero



36
37
38
# File 'lib/puma/null_io.rb', line 36

def size
  0
end

#sync=(v) ⇒ Object



40
41
# File 'lib/puma/null_io.rb', line 40

def sync=(v)
end

#write(*ary) ⇒ Object



46
47
# File 'lib/puma/null_io.rb', line 46

def write(*ary)
end