Sha256: 3fcd6914c292912a16d2e5028acbe1d9b29ccb08794e4cdf345f2240d2451e64
Contents?: true
Size: 900 Bytes
Versions: 1
Compression:
Stored size: 900 Bytes
Contents
# frozen_string_literal: true module Html2rss class AutoSource module Scraper class Schema ## # Handles schema.org ItemList objects, which contain # 1. itemListElements, and/or # 2. interesting attributes, i.e. description, url, image, itself. # # @see https://schema.org/ItemList class ItemList < Thing SUPPORTED_TYPES = Set['ItemList'] # @return [Array<Hash>] the scraped article hashes with DEFAULT_ATTRIBUTES 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 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
html2rss-0.16.0 | lib/html2rss/auto_source/scraper/schema/item_list.rb |