module SiteChecker
Constants
- VERSION
Attributes
Public Class Methods
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
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
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
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
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
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
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
# 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