Sha256: c278904b5059fa3bb4b4fdf5b4a4cd82f931b11db2c6117e098b1354af8e9a30

Contents?: true

Size: 683 Bytes

Versions: 28

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

module Puma
  # 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.
  #
  class NullIO
    def gets
      nil
    end

    def string
      ""
    end

    def each
    end

    # Mimics IO#read with no data.
    #
    def read(count = nil, _buffer = nil)
      count && count > 0 ? nil : ""
    end

    def rewind
    end

    def close
    end

    def size
      0
    end

    def eof?
      true
    end

    def sync
      true
    end

    def sync=(v)
    end

    def puts(*ary)
    end

    def write(*ary)
    end

    def flush
      self
    end
  end
end

Version data entries

28 entries across 28 versions & 4 rubygems

Version Path
puma-5.6.4-java lib/puma/null_io.rb
puma-5.6.4 lib/puma/null_io.rb
puma-5.6.2-java lib/puma/null_io.rb
puma-5.6.2 lib/puma/null_io.rb
puma-5.6.1-java lib/puma/null_io.rb
puma-5.6.1 lib/puma/null_io.rb
puma-5.6.0-java lib/puma/null_io.rb
puma-5.6.0 lib/puma/null_io.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/puma-5.5.2/lib/puma/null_io.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/puma-5.5.2/lib/puma/null_io.rb
puma-5.5.2-java lib/puma/null_io.rb
puma-5.5.2 lib/puma/null_io.rb
puma-5.5.1-java lib/puma/null_io.rb
puma-5.5.1 lib/puma/null_io.rb
puma-5.5.0-java lib/puma/null_io.rb
puma-5.5.0 lib/puma/null_io.rb
piesync-puma-5.4.0.1 lib/puma/null_io.rb
puma-5.4.0-java lib/puma/null_io.rb
puma-5.4.0 lib/puma/null_io.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/puma-5.2.2/lib/puma/null_io.rb