Module: Html2rss::FeedResolution::Policy

Defined in:
lib/html2rss/feed_resolution/policy.rb

Overview

Decides whether an entry URL tournament should run after a weak extract.

Constant Summary collapse

ARTICLE_FLOOR =

Minimum admitted articles before the entry URL is considered strong enough.

3

Class Method Summary collapse

Class Method Details

.resolve?(config:, articles:, surface_category:) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


18
19
20
21
22
23
24
25
26
# File 'lib/html2rss/feed_resolution/policy.rb', line 18

def resolve?(config:, articles:, surface_category:)
  raise ArgumentError, 'articles must be an Array' unless articles.is_a?(Array)
  return false unless eligible_config?(config)

  category = SurfaceCategory.coerce(surface_category)
  return false if category.blocked?

  articles.size < ARTICLE_FLOOR || category.weak? || native_feed_majority?(articles)
end