module SiteChecker

Constants

VERSION

Attributes

dsl_enabled[RW]
ignore_list[RW]
max_recursion_depth[RW]
visit_references[RW]

Public Class Methods

check(url, root=nil) click to toggle source

Recursively visits the provided url looking for reference problems.

@param [String] url where the processing starts @param [String] root (optional) the root URL of the site. If not provided then the method will use the url to figure it out.

# File lib/site_checker.rb, line 51
def check(url, root=nil)
  create_instance
  @link_collector.check(url, root)
end
configure() { |self| ... } click to toggle source

The following configuration options, which can be used together, are available:

  • ignoring certain links:

    SiteChecker.configure do |config|
      config.ignore_list = ["/", "/atom.xml"]
    end
    
  • visit the external references as well:

    SiteChecker.configure do |config|
      config.visit_references = true
    end
    
  • set the depth of the recursion:

    SiteChecker.configure do |config|
      config.max_recursion_depth = 3
    end
    
# File lib/site_checker.rb, line 41
def configure
  yield self
end
local_images() click to toggle source

Returns the Array of the visited local images.

@return [Array] list of the visited local images

# File lib/site_checker.rb, line 79
def local_images
  @link_collector.local_images
end
local_pages() click to toggle source

Returns the Array of the visited local pages.

@return [Array] list of the visited local pages

# File lib/site_checker.rb, line 61
def local_pages
  @link_collector.local_pages
end
problems() click to toggle source

Returns the Hash (:parent_url => [Array of problematic links]) of the problems.

@return [Hash] the result of the check

# File lib/site_checker.rb, line 97
def problems
  @link_collector.problems
end
remote_images() click to toggle source

Returns the Array of the visited remote (external) images.

@return [Array] list of the visited remote images

# File lib/site_checker.rb, line 88
def remote_images
  @link_collector.remote_images
end
remote_pages() click to toggle source

Returns the Array of the visited remote (external) pages.

@return [Array] list of the visited remote pages

# File lib/site_checker.rb, line 70
def remote_pages
  @link_collector.remote_pages
end

Private Class Methods

create_instance() click to toggle source
# File lib/site_checker.rb, line 102
def create_instance
  @link_collector = SiteChecker::LinkCollector.new do |config|
    config.visit_references = @visit_references if @visit_references
    config.ignore_list = @ignore_list if @ignore_list
    config.max_recursion_depth = @max_recursion_depth if @max_recursion_depth
  end
end