Sha256: 4bf42418c298dbb5fc04dba015dc7acdfa850845d529cb02df4a6d651908fff3
Contents?: true
Size: 698 Bytes
Versions: 20
Compression:
Stored size: 698 Bytes
Contents
require 'link_thumbnailer/scrapers/default/base' require 'link_thumbnailer/models/favicon' module LinkThumbnailer module Scrapers module Default class Favicon < ::LinkThumbnailer::Scrapers::Default::Base def value modelize(to_uri(href)).to_s end private def to_uri(href) ::URI.parse(href) rescue ::URI::InvalidURIError nil end def href node.attributes['href'].value.to_s if node end def node document.xpath("//link[contains(@rel, 'icon')]").first end def modelize(uri) model_class.new(uri) end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems