Module: UrlInfoExtractor::Favicon

Included in:
UrlInfoExtractor
Defined in:
lib/url_info_extractor/favicon.rb

Instance Method Summary collapse

Instance Method Details

#favicon_exists?Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/url_info_extractor/favicon.rb', line 10

def favicon_exists?
  response = do_http_request(favicon_url, :head)
  response.is_a? Net::HTTPSuccess
end

#favicon_urlObject



3
4
5
6
7
8
9
# File 'lib/url_info_extractor/favicon.rb', line 3

def favicon_url
  base = fetched_data[:base_link_value]
  uri = base ? URI.parse(base) : @uri
  link = fetched_data[:favicon_link_value]
  link ||= '/favicon.ico'
  uri.merge(URI.parse(link)).to_s
end