Module: Html2rss::FeedBuilder

Defined in:
lib/html2rss/feed_builder.rb,
lib/html2rss/feed_builder/rss.rb,
lib/html2rss/feed_builder/json_feed.rb,
lib/html2rss/feed_builder/json_feed/item.rb,
lib/html2rss/feed_builder/rss/stylesheet.rb

Overview

Entrypoint and namespace for feed building and formatting (RSS 2.0 / JSON Feed 1.1).

Defined Under Namespace

Classes: JsonFeed, Rss

Class Method Summary collapse

Class Method Details

.build(type, channel:, articles:) ⇒ RSS::Rss, Hash

Builds the requested feed type from the channel and article list.

Parameters:

Returns:

  • (RSS::Rss, Hash)

    format-compliant representation of the feed



12
13
14
15
16
17
18
19
20
21
# File 'lib/html2rss/feed_builder.rb', line 12

def self.build(type, channel:, articles:, **)
  case type
  when :rss
    Rss.new(channel:, articles:, **).call
  when :json_feed
    JsonFeed.new(channel:, articles:).call
  else
    raise ArgumentError, "Unknown feed type: #{type}"
  end
end