Class: Html2rss::AutoSource::Scraper::Schema::ItemList
- Defined in:
- lib/html2rss/auto_source/scraper/schema/item_list.rb
Overview
Walks schema.org ItemList objects and yields article-shaped elements only. The ItemList container itself is never emitted.
Constant Summary collapse
- SUPPORTED_TYPES =
Schema.org type names handled by the ItemList extractor.
Set['ItemList']
Constants inherited from Thing
Instance Attribute Summary
Attributes inherited from Thing
Instance Method Summary collapse
-
#call ⇒ Array<Hash>
Article hashes from list elements (no parent container).
Methods inherited from Thing
#author, #categories, #description, #id, #image, #image_urls, #initialize, #published_at, #title, #url
Constructor Details
This class inherits a constructor from Html2rss::AutoSource::Scraper::Schema::Thing
Instance Method Details
#call ⇒ Array<Hash>
Returns article hashes from list elements (no parent container).
17 18 19 20 21 22 23 |
# File 'lib/html2rss/auto_source/scraper/schema/item_list.rb', line 17 def call elements = @schema_object[:itemListElement] return [] unless elements elements = [elements] unless elements.is_a?(Array) elements.filter_map { |element| materialize_element(element) } end |