You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: parser.rb
    path of file: ./repos/devdocs/lib/docs/core
    
    the code of the file until where you have to start completion: module Docs
  class Parser
    attr_reader :title, :html

    def initialize(content)
      @content = content
      @html = document? ? pa
    
    def initialize(content)
      @content = content
      @html = document? ? parse_as_document : parse_as_fragment
    end

    private

    DOCUMENT_RGX = /\A(?:\s|(?:<!--.*?-->))*<(?:\!doctype|html)/i

    def document?
      @content =~ DOCUMENT_RGX
    end

    def parse_as_document
      document = Nokogiri::HTML.parse @content, nil, 'UTF-8'
      @title = document.at_css('title').try(:content)
      document
    end

    def parse_as_fragment
      Nokogiri::HTML.fragment @content, 'UTF-8'
    end
  end
end