Class: Html2rss::Html::ArticleExtractor::DateExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/html/article_extractor/date_extractor.rb

Overview

Extracts the earliest date from an article_tag.

Class Method Summary collapse

Class Method Details

.call(article_tag) ⇒ DateTime?

Parameters:

  • article_tag (Nokogiri::XML::Element)

    article container node

Returns:

  • (DateTime, nil)


10
11
12
13
# File 'lib/html2rss/html/article_extractor/date_extractor.rb', line 10

def self.call()
  datetimes = .css('[datetime]').map { |tag| tag['datetime'] }
  ArticleRules::Date.earliest(datetimes)
end