Class: Html2rss::AutoSource::Scraper::Schema::ItemList
- Defined in:
- lib/html2rss/auto_source/scraper/schema/item_list.rb
Overview
Handles schema.org ItemList objects, which contain
-
itemListElements, and/or
-
interesting attributes, i.e. description, url, image, itself.
Constant Summary collapse
- SUPPORTED_TYPES =
Set['ItemList']
Constants inherited from Thing
Instance Method Summary collapse
-
#call ⇒ Array<Hash>
The scraped article hashes with DEFAULT_ATTRIBUTES.
Methods inherited from Thing
#description, #id, #image, #initialize, #published_at, #title, #url
Constructor Details
This class inherits a constructor from Html2rss::AutoSource::Scraper::Schema::Thing
Instance Method Details
permalink #call ⇒ Array<Hash>
Returns the scraped article hashes with DEFAULT_ATTRIBUTES.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/html2rss/auto_source/scraper/schema/item_list.rb', line 17 def call hashes = [super] return hashes if (elements = @schema_object[:itemListElement]).nil? elements = [elements] unless elements.is_a?(Array) elements.each do |schema_object| hashes << ListItem.new(schema_object, url: @url).call end hashes end |