123456789_123456789_123456789_123456789_123456789_

Module: RSS::Maker

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

Constant Summary

Class Method Summary

Class Method Details

.[](version)

Returns the maker for the version

[ GitHub ]

  
# File 'lib/rss/maker.rb', line 32

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

.add_maker(version, normalized_version, maker)

Adds a maker to the set of supported makers

[ GitHub ]

  
# File 'lib/rss/maker.rb', line 39

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

.make(version, &block)

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

[ GitHub ]

  
# File 'lib/rss/maker.rb', line 27

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

.maker(version) (private)

Can I remove this method?

[ GitHub ]

  
# File 'lib/rss/maker.rb', line 60

def maker(version)
  MAKERS[version]
end

.makers

Returns collection of supported makers

[ GitHub ]

  
# File 'lib/rss/maker.rb', line 49

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

.supported?(version) ⇒ Boolean

Returns true if the version is supported

[ GitHub ]

  
# File 'lib/rss/maker.rb', line 54

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

.versions

Returns collection of supported maker versions

[ GitHub ]

  
# File 'lib/rss/maker.rb', line 44

def versions
  MAKERS.keys.uniq.sort
end