class Nokogiri::HTML5::Document

def read_io(io, url = nil, encoding = nil, **options)

💡 Most users should prefer Document.parse to this method.

Create a new document from an IO object.
def read_io(io, url = nil, encoding = nil, **options)
  raise ArgumentError, "io object doesn't respond to :read" unless io.respond_to?(:read)
  do_parse(io, url, encoding, options)
end