Sha256: 4c2f7272c3a3542ca6337be530b8ef4ef5d482b689fdcad219b7fb9cb5cb6358

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

module Html2rss
  class AutoSource
    module Scraper
      class Schema
        ##
        #
        # @see https://schema.org/ListItem
        class ListItem < Thing
          def id =          (id = (schema_object.dig(:item, :@id) || super).to_s).empty? ? nil : id
          def title =       schema_object.dig(:item, :name) || super || (url ? Utils.titleized_url(url) : nil)
          def description = schema_object.dig(:item, :description) || super

          # @return [Addressable::URI, nil]
          def url
            url = schema_object.dig(:item, :url) || super

            Utils.build_absolute_url_from_relative(url, @url) if url
          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/list_item.rb