Class: Html2rss::RssBuilder::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/rss_builder/item.rb

Overview

Builds an <item> tag (with the provided maker).

Constant Summary collapse

SPECIAL_TAGS =

Tags which should be processed every time and require non-trivial assignments/treatments.

%i[categories enclosure guid].freeze

Class Method Summary collapse

Class Method Details

.add(maker, item, tags) ⇒ Object

Adds the item to the Item Maker

Parameters:

  • maker (RSS::Maker::RSS20::Items::Item)
  • item (Html2rss::Item)
  • tags (Set<Symbol>)

Returns:

  • nil



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/html2rss/rss_builder/item.rb', line 20

def self.add(maker, item, tags)
  tags.each do |tag|
    next if SPECIAL_TAGS.include?(tag)

    maker.public_send(:"#{tag}=", item.public_send(tag))
  end

  SPECIAL_TAGS.each do |tag|
    send(:"add_#{tag}", item, maker)
  end
end