Class: FaviconExtractor::ExtractsFaviconsFromHtml

Inherits:
Object
  • Object
show all
Defined in:
lib/favicon_extractor/extracts_favicons_from_html.rb

Class Method Summary collapse

Class Method Details

.extract(html, url) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/favicon_extractor/extracts_favicons_from_html.rb', line 5

def extract(html, url)
  @url = url
  html.scan(/<link.*?icon.*?>/).flatten.map do |str|
    str.match(/href="(.*?)"/).captures.first
  end
    .map { |str| handle_relative_paths(str) }
    .append(default_favicon)
end