class Accessibility::Checker

An Accessibility::Checker is initialized by passing it the URL of the web page to check.

It is in charge of making the request to the access-lint-server, which will perform the accessibility audit using the AccessLint gem and return the results as JSON.

It delegates the results parsing to an Accessibility::Audit, which in turn will consult the raw JSON from this checker to generate the collections of audit rules.

Example:

a11y = Accessibility::Checker.new('http://validationhell.com')

You can (and should) specify the URL where your access-lint-server instance is to be found, as the default value is not a production-ready server, which might be under heavy load:

a11y = Accessibility::Checker.new( 'http://validationhell.com',
                                   checker_uri: 'http://mychecker.com' )

For brevity, you can use the convenience shortcut on the top-level module:

a11y = Accessibility.check('http://validationhell.com')

Attributes

checker_uri[R]
url[R]

Public Class Methods

new(url, options = {}) click to toggle source
# File lib/accessibility/checker.rb, line 36
def initialize(url, options = {})
  options = defaults.merge(options)

  @url         = url
  @checker_uri = options[:checker_uri]

  @audit       = Accessibility::Audit.new(self)
end

Public Instance Methods

raw() click to toggle source

Returns the parsed JSON from the response of the access-lint-server

# File lib/accessibility/checker.rb, line 46
def raw
  @raw ||= JSON.parse HTTParty.get("#{checker_uri}/check?url=#{url}").body
end

Private Instance Methods

defaults() click to toggle source
# File lib/accessibility/checker.rb, line 55
def defaults
  { checker_uri: 'https://access-lint-server-demo.herokuapp.com' }
end