Class: Html2rss::HtmlExtractor::DateExtractor
- Inherits:
-
Object
- Object
- Html2rss::HtmlExtractor::DateExtractor
- Defined in:
- lib/html2rss/html_extractor/date_extractor.rb
Overview
Extracts the earliest date from an article_tag.
Class Method Summary collapse
Class Method Details
.call(article_tag) ⇒ DateTime?
8 9 10 11 12 13 14 15 16 |
# File 'lib/html2rss/html_extractor/date_extractor.rb', line 8 def self.call(article_tag) times = article_tag.css('[datetime]').filter_map do |tag| DateTime.parse(tag['datetime']) rescue ArgumentError, TypeError nil end times.min end |