Module: RSS::Maker

Defined in:
lib/rss/maker.rb,
lib/rss/maker/0.9.rb,
lib/rss/maker/1.0.rb,
lib/rss/maker/2.0.rb,
lib/rss/maker/atom.rb,
lib/rss/maker/base.rb,
lib/rss/maker/feed.rb,
lib/rss/maker/entry.rb,
lib/rss/maker/image.rb,
lib/rss/maker/slash.rb,
lib/rss/maker/itunes.rb,
lib/rss/maker/content.rb,
lib/rss/maker/taxonomy.rb,
lib/rss/maker/trackback.rb,
lib/rss/maker/dublincore.rb,
lib/rss/maker/syndication.rb

Overview

Provides a set of builders for various RSS objects

  • Feeds

    • RSS 0.91

    • RSS 1.0

    • RSS 2.0

    • Atom 1.0

  • Elements

    • Atom::Entry

Defined Under Namespace

Modules: Atom, AtomCategory, AtomGenerator, AtomLink, AtomLogo, AtomPersonConstructBase, AtomPersons, AtomTextConstruct, AtomTextConstructBase, ContentModel, DublinCoreModel, ITunesBaseModel, ITunesChannelModel, ITunesItemModel, ImageFaviconModel, ImageItemModel, SetupDefaultDate, SetupDefaultLanguage, SlashModel, SyndicationModel, TaxonomyTopicModel, TaxonomyTopicsModel, TrackBackModel Classes: Base, ChannelBase, ImageBase, ItemsBase, RSS09, RSS091, RSS092, RSS10, RSS20, RSSBase, TextinputBase, XMLStyleSheets

Constant Summary collapse

MAKERS =

Collection of supported makers

{}

Class Method Summary collapse

Class Method Details

.[](version) ⇒ Object

Returns the maker for the version



33
34
35
36
37
# File 'lib/rss/maker.rb', line 33

def [](version)
  maker_info = maker(version)
  raise UnsupportedMakerVersionError.new(version) if maker_info.nil?
  maker_info[:maker]
end

.add_maker(version, normalized_version, maker) ⇒ Object

Adds a maker to the set of supported makers



40
41
42
# File 'lib/rss/maker.rb', line 40

def add_maker(version, normalized_version, maker)
  MAKERS[version] = {:maker => maker, :version => normalized_version}
end

.make(version, &block) ⇒ Object

Builder for an RSS object Creates an object of the type passed in args

Executes the block to populate elements of the created RSS object



28
29
30
# File 'lib/rss/maker.rb', line 28

def make(version, &block)
  self[version].make(&block)
end

.makersObject

Returns collection of supported makers



50
51
52
# File 'lib/rss/maker.rb', line 50

def makers
  MAKERS.values.collect { |info| info[:maker] }.uniq
end

.supported?(version) ⇒ Boolean

Returns true if the version is supported

Returns:

  • (Boolean)


55
56
57
# File 'lib/rss/maker.rb', line 55

def supported?(version)
  versions.include?(version)
end

.versionsObject

Returns collection of supported maker versions



45
46
47
# File 'lib/rss/maker.rb', line 45

def versions
  MAKERS.keys.uniq.sort
end