Class: Html2rss::AutoSource::Reducer

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/auto_source/reducer.rb

Overview

Reducer is responsible for reducing the list of articles. It keeps only the longest attributes of articles with the same URL. It also filters out invalid articles.

Class Method Summary collapse

Class Method Details

.call(articles, **_options) ⇒ Object



11
12
13
14
15
# File 'lib/html2rss/auto_source/reducer.rb', line 11

def call(articles, **_options)
  Log.debug "Reducer: inited with #{articles.size} articles"

  reduce_by_keeping_longest_values(articles, keep: [:scraper]) { |article| article.url&.path }
end