class RSS::Atom::Entry - rss: Ruby Standard Library Documentation

# class RSS::Atom::Entry

Defines a top-level `Atom` `Entry` element, used as the document element of a stand-alone `Atom` `Entry` Document. It has the following attributes:

- author

- category

- categories

- content

- contributor

- id

- link

- published

- rights

- source

- summary

- title

- updated

Reference: validator.w3.org/feed/docs/rfc4287.html#element.entry]

### Constants

Author

  Feed::Entry::Author

Category

  Feed::Entry::Category

Content

  `Feed::Entry::Content`

Contributor

  Feed::Entry::Contributor

Id

  Feed::Entry::Id

Link

  Feed::Entry::Link

Published

  `Feed::Entry::Published`

Rights

  Feed::Entry::Rights

Source

  `Feed::Entry::Source`

Summary

  `Feed::Entry::Summary`

Title

  Feed::Entry::Title

Updated

  Feed::Entry::Updated

### Public Class Methods

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

Creates a new `Atom` `Entry` element.

Calls superclass method `RSS::RootElementMixin::new`

    # File rss-0.3.1/lib/rss/atom.rb, line 922
    def initialize(version=nil, encoding=nil, standalone=nil)
      super("1.0", version, encoding, standalone)
      @feed_type = "atom"
      @feed_subtype = "entry"
    end

### Public Instance Methods

have_author?() click to toggle source

Returns where there are any authors present or there is a source with an author.

    # File rss-0.3.1/lib/rss/atom.rb, line 941
    def have_author?
      authors.any? {|author| !author.to_s.empty?} or
        (source and source.have_author?)
    end

items() click to toggle source

Returns the `Entry` in an array.

    # File rss-0.3.1/lib/rss/atom.rb, line 929
    def items
      [self]
    end

setup_maker(maker) click to toggle source

Sets up the `maker` for constructing `Entry` elements.

Calls superclass method `RSS::RootElementMixin#setup_maker`

    # File rss-0.3.1/lib/rss/atom.rb, line 934
    def setup_maker(maker)
      maker = maker.maker if maker.respond_to?("maker")
      super(maker)
    end

### Private Instance Methods

atom_validate(ignore_unknown_element, tags, uri) click to toggle source

    # File rss-0.3.1/lib/rss/atom.rb, line 947
    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 rss-0.3.1/lib/rss/atom.rb, line 954
    def have_required_elements?
      super and have_author?
    end

maker_target(maker) click to toggle source

    # File rss-0.3.1/lib/rss/atom.rb, line 958
    def maker_target(maker)
      maker.items.new_item
    end