class Puma::NullIO

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.

Public Instance Methods

close() click to toggle source
# File lib/puma/null_io.rb, line 42
def close
end
closed?() click to toggle source

This is used as singleton class, so can't have state.

# File lib/puma/null_io.rb, line 71
def closed?
  false
end
each() click to toggle source
# File lib/puma/null_io.rb, line 16
def each
end
eof?() click to toggle source
# File lib/puma/null_io.rb, line 49
def eof?
  true
end
flush() click to toggle source
# File lib/puma/null_io.rb, line 66
def flush
  self
end
gets() click to toggle source
# File lib/puma/null_io.rb, line 8
def gets
  nil
end
puts(*ary) click to toggle source
# File lib/puma/null_io.rb, line 60
def puts(*ary)
end
read(length = nil, buffer = nil) click to toggle source

Mimics IO#read with no data.

# File lib/puma/null_io.rb, line 21
def read(length = nil, buffer = nil)
  if length.to_i < 0
    raise ArgumentError, "(negative length #{length} given)"
  end

  buffer = if buffer.nil?
    "".b
  else
    String.try_convert(buffer) or raise TypeError, "no implicit conversion of #{buffer.class} into String"
  end
  buffer.clear
  if length.to_i > 0
    nil
  else
    buffer
  end
end
rewind() click to toggle source
# File lib/puma/null_io.rb, line 39
def rewind
end
size() click to toggle source
# File lib/puma/null_io.rb, line 45
def size
  0
end
string() click to toggle source
# File lib/puma/null_io.rb, line 12
def string
  ""
end
sync() click to toggle source
# File lib/puma/null_io.rb, line 53
def sync
  true
end
sync=(v) click to toggle source
# File lib/puma/null_io.rb, line 57
def sync=(v)
end
write(*ary) click to toggle source
# File lib/puma/null_io.rb, line 63
def write(*ary)
end