class SiteInspector

Constants

VERSION

Attributes

cache[W]
timeout[W]
typhoeus_options[W]

Public Class Methods

cache() click to toggle source
# File lib/site-inspector.rb, line 37
def cache
  @cache ||= if ENV['CACHE']
               SiteInspector::DiskCache.new
             elsif Object.const_defined?('Rails')
               SiteInspector::RailsCache.new
             else
               SiteInspector::Cache.new
             end
end
hydra() click to toggle source

Returns a thread-safe, memoized hydra instance

# File lib/site-inspector.rb, line 70
def hydra
  Typhoeus::Hydra.hydra
end
inspect(domain) click to toggle source
# File lib/site-inspector.rb, line 51
def inspect(domain)
  Domain.new(domain)
end
timeout() click to toggle source
# File lib/site-inspector.rb, line 47
def timeout
  @timeout || 10
end
typhoeus_defaults() click to toggle source
# File lib/site-inspector.rb, line 55
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