Module: Rssly::Collection::UniqueFilter

Defined in:
lib/rssly/collection/unique_filter.rb

Overview

Filters out any articles that have the same url in the set.

Class Method Summary collapse

Class Method Details

.parse(articles, **args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rssly/collection/unique_filter.rb', line 7

def self.parse(articles, **args)
  bf = BloomFilter::Native.new(
    size: 10000
  )

  articles.select do |article|
    unless bf.include?(article.url)
      bf.insert article.url
      true
    end
  end
end