class RSS::Atom::Feed

Atom feed element

A Feed has several metadata attributes in addition to a number of Entry child elements

Public Class Methods

new(version=nil, encoding=nil, standalone=nil) click to toggle source

Creates a new Atom feed

Calls superclass method RSS::RootElementMixin.new
# File lib/rss/atom.rb, line 278
def initialize(version=nil, encoding=nil, standalone=nil)
  super("1.0", version, encoding, standalone)
  @feed_type = "atom"
  @feed_subtype = "feed"
end

Public Instance Methods

have_author?() click to toggle source

Returns true if there are any authors for the feed or any of the Entry child elements have an author

# File lib/rss/atom.rb, line 288
def have_author?
  authors.any? {|author| !author.to_s.empty?} or
    entries.any? {|entry| entry.have_author?(false)}
end

Private Instance Methods

atom_validate(ignore_unknown_element, tags, uri) click to toggle source
# File lib/rss/atom.rb, line 294
def atom_validate(ignore_unknown_element, tags, uri)
  unless have_author?
    raise MissingTagError.new("author", tag_name)
  end
  validate_duplicate_links(links)
end
have_required_elements?() click to toggle source
Calls superclass method RSS::Element#have_required_elements?
# File lib/rss/atom.rb, line 301
def have_required_elements?
  super and have_author?
end
maker_target(maker) click to toggle source
# File lib/rss/atom.rb, line 305
def maker_target(maker)
  maker.channel
end
setup_maker_element(channel) click to toggle source
Calls superclass method RSS::SetupMaker#setup_maker_element
# File lib/rss/atom.rb, line 309
def setup_maker_element(channel)
  prev_dc_dates = channel.dc_dates.to_a.dup
  super
  channel.about = id.content if id
  channel.dc_dates.replace(prev_dc_dates)
end
setup_maker_elements(channel) click to toggle source
Calls superclass method RSS::SetupMaker#setup_maker_elements
# File lib/rss/atom.rb, line 316
def setup_maker_elements(channel)
  super
  items = channel.maker.items
  entries.each do |entry|
    entry.setup_maker(items)
  end
end