Class: LinkThumbnailer::Scrapers::Base
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- LinkThumbnailer::Scrapers::Base
- Defined in:
- lib/link_thumbnailer/scrapers/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attribute_name ⇒ Object
readonly
Returns the value of attribute attribute_name.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#website ⇒ Object
readonly
Returns the value of attribute website.
Instance Method Summary collapse
- #applicable? ⇒ Boolean
- #call(attribute_name) ⇒ Object
-
#initialize(document, website = nil) ⇒ Base
constructor
A new instance of Base.
- #value ⇒ Object
Constructor Details
#initialize(document, website = nil) ⇒ Base
Returns a new instance of Base.
15 16 17 18 19 20 21 |
# File 'lib/link_thumbnailer/scrapers/base.rb', line 15 def initialize(document, website = nil) @config = ::LinkThumbnailer.page.config @document = document @website = website super(config) end |
Instance Attribute Details
#attribute_name ⇒ Object (readonly)
Returns the value of attribute attribute_name.
13 14 15 |
# File 'lib/link_thumbnailer/scrapers/base.rb', line 13 def attribute_name @attribute_name end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/link_thumbnailer/scrapers/base.rb', line 13 def config @config end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
13 14 15 |
# File 'lib/link_thumbnailer/scrapers/base.rb', line 13 def document @document end |
#website ⇒ Object (readonly)
Returns the value of attribute website.
13 14 15 |
# File 'lib/link_thumbnailer/scrapers/base.rb', line 13 def website @website end |
Instance Method Details
#applicable? ⇒ Boolean
33 34 35 |
# File 'lib/link_thumbnailer/scrapers/base.rb', line 33 def applicable? true end |
#call(attribute_name) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/link_thumbnailer/scrapers/base.rb', line 23 def call(attribute_name) return false unless website.present? return false unless applicable? @attribute_name = attribute_name website.send("#{attribute_name}=", value) website end |
#value ⇒ Object
37 38 39 |
# File 'lib/link_thumbnailer/scrapers/base.rb', line 37 def value fail NotImplementedError end |