module Aquanaut

Main module of Aquanaut

Constants

VERSION

Version of this gem

Public Class Methods

process_domain(target_address) click to toggle source

Processes the given target domain and creates a page and asset graph.

@param [String] target_address

@return [Graph] the sitemap graph with pages and static assets

# File lib/aquanaut.rb, line 19
def process_domain(target_address)
  worker = Worker.new(target_address)
  graph = Graph.new

  worker.explore do |page_uri, links, static_assets|
    graph.add_node(PageNode.new(page_uri))

    links.each do |link_uri|
      graph.add_node(PageNode.new(link_uri))
      graph.add_edge(page_uri, link_uri)
    end

    static_assets.each do |asset|
      graph.add_node(AssetNode.new(asset['uri'], asset['type']))
      graph.add_edge(page_uri, asset['uri'])
    end
  end

  return graph
end