lib/link_thumbnailer/scrapers/base.rb in link_thumbnailer-2.4.0 vs lib/link_thumbnailer/scrapers/base.rb in link_thumbnailer-2.5.0

- old
+ new

@@ -8,20 +8,22 @@ module Scrapers class Base < ::SimpleDelegator attr_reader :config, :document, :website, :attribute_name - def initialize(document) + def initialize(document, website = nil) @config = ::LinkThumbnailer.page.config @document = document + @website = website super(config) end - def call(website, attribute_name) + def call(attribute_name) + return false unless website.present? return false unless applicable? - @website = website + @attribute_name = attribute_name website.send("#{attribute_name}=", value) website end @@ -29,10 +31,10 @@ def applicable? true end def value - raise 'must implement' + fail NotImplementedError end private def meta_xpath(options = {})