def process document
      return unless document.valid
      # If we're debugging, output the canonical_url
      emitter.log(document.url.canonical_url.colorize(:green))
      # Attach the emitter to the document
      document.emitter = emitter
      # enqueue any other pages being linked to
      enqueue(document.links)

      # rewrite all absolute links, asset urls, etc
      # to use local, relative paths
      # document.rewrite

      # Write the document to file
      document.write!

      # Mark this document's canonical_url as processed
      processed_urls << document.url.canonical_url
    end
def process document
      return unless document.valid
      # If we're debugging, output the canonical_url
      emitter.log(document.url.canonical_url.colorize(:green))
      # Attach the emitter to the document
      document.emitter = emitter
      # enqueue any other pages being linked to
      enqueue(document.links)

      # rewrite all absolute links, asset urls, etc
      # to use local, relative paths
      # document.rewrite

      # Write the document to file
      document.write!

      # Mark this document's canonical_url as processed
      processed_urls << document.url.canonical_url
    end
Process a document, fetching its content and enqueueing it for
 sub processing