class Nokogiri::HTML4::SAX::ParserContext

you should be looking at Nokogiri::HTML4::SAX::Parser
Context for HTML SAX parsers. This class is usually not instantiated by the user. Instead,
##

def self.new(thing, encoding = "UTF-8")

def self.new(thing, encoding = "UTF-8")
  if [:read, :close].all? { |x| thing.respond_to?(x) }
    super
  else
    memory(thing, encoding)
  end
end