Class: SiteInspector

Inherits:
Object
  • Object
show all
Defined in:
lib/site-inspector.rb,
lib/site-inspector/cache.rb,
lib/site-inspector/domain.rb,
lib/site-inspector/version.rb,
lib/site-inspector/endpoint.rb,
lib/site-inspector/checks/dns.rb,
lib/site-inspector/disk_cache.rb,
lib/site-inspector/checks/hsts.rb,
lib/site-inspector/rails_cache.rb,
lib/site-inspector/checks/check.rb,
lib/site-inspector/checks/https.rb,
lib/site-inspector/checks/content.rb,
lib/site-inspector/checks/cookies.rb,
lib/site-inspector/checks/headers.rb,
lib/site-inspector/checks/sniffer.rb,
lib/site-inspector/checks/accessibility.rb

Defined Under Namespace

Classes: Cache, DiskCache, Domain, Endpoint, RailsCache

Constant Summary collapse

VERSION =
'3.1.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cacheObject



30
31
32
33
34
35
36
37
38
# File 'lib/site-inspector.rb', line 30

def cache
  @cache ||= if ENV['CACHE']
    SiteInspector::DiskCache.new
  elsif Object.const_defined?('Rails')
    SiteInspector::RailsCache.new
  else
    SiteInspector::Cache.new
  end
end

.timeoutObject



40
41
42
# File 'lib/site-inspector.rb', line 40

def timeout
  @timeout || 10
end

.typhoeus_options=(value) ⇒ Object (writeonly)

Sets the attribute typhoeus_options

Parameters:

  • value

    the value to set the attribute typhoeus_options to.



28
29
30
# File 'lib/site-inspector.rb', line 28

def typhoeus_options=(value)
  @typhoeus_options = value
end

Class Method Details

.hydraObject

Returns a thread-safe, memoized hydra instance



63
64
65
# File 'lib/site-inspector.rb', line 63

def hydra
  Typhoeus::Hydra.hydra
end

.inspect(domain) ⇒ Object



44
45
46
# File 'lib/site-inspector.rb', line 44

def inspect(domain)
  Domain.new(domain)
end

.typhoeus_defaultsObject



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/site-inspector.rb', line 48

def typhoeus_defaults
  defaults = {
    followlocation:  false,
    timeout:         SiteInspector.timeout,
    accept_encoding: 'gzip',
    method:          :head,
    headers:         {
      'User-Agent' => "Mozilla/5.0 (compatible; SiteInspector/#{SiteInspector::VERSION}; +https://github.com/benbalter/site-inspector)"
    }
  }
  defaults.merge! @typhoeus_options if @typhoeus_options
  defaults
end