Class: Html2rss::FeedPipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/feed_pipeline.rb,
lib/html2rss/feed_pipeline/auto_fallback.rb,
lib/html2rss/feed_pipeline/strategy_plan.rb,
lib/html2rss/feed_pipeline/runtime_policy.rb

Overview

Builds feeds from validated config through request, extraction, and rendering stages.

Defined Under Namespace

Classes: AutoFallback, ExtractionContext, RuntimePolicy, StrategyPlan

Instance Method Summary collapse

Constructor Details

#initialize(raw_config) ⇒ FeedPipeline

Returns a new instance of FeedPipeline.

Parameters:

  • raw_config (Hash{Symbol => Object})

    user-provided feed config



12
13
14
# File 'lib/html2rss/feed_pipeline.rb', line 12

def initialize(raw_config)
  @raw_config = raw_config
end

Instance Method Details

#to_json_feedHash

Returns generated JSONFeed 1.1 payload.

Returns:

  • (Hash)

    generated JSONFeed 1.1 payload



27
28
29
30
31
32
# File 'lib/html2rss/feed_pipeline.rb', line 27

def to_json_feed
  run do |response:, config:, articles:|
    channel = Html2rss::Channel.new(response, overrides: config.channel)
    FeedBuilder.build(:json_feed, channel:, articles:)
  end
end

#to_rssRSS::Rss

Returns generated RSS feed.

Returns:

  • (RSS::Rss)

    generated RSS feed



18
19
20
21
22
23
# File 'lib/html2rss/feed_pipeline.rb', line 18

def to_rss
  run do |response:, config:, articles:|
    channel = Html2rss::Channel.new(response, overrides: config.channel)
    FeedBuilder.build(:rss, channel:, articles:, stylesheets: config.stylesheets)
  end
end