Class: AtomFeed::AtomFeedEntry
- Defined in:
- lib/atom_feed/atom_feed_entry.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
-
#authors ⇒ Object
Array of authors (optional).
-
#categories ⇒ Object
categories (optional).
-
#content ⇒ Object
Content (optional).
-
#contributors ⇒ Object
contributors (optional).
-
#id ⇒ Object
Entry id (required).
-
#initialize(node) ⇒ AtomFeedEntry
constructor
A new instance of AtomFeedEntry.
-
#links ⇒ Object
Array of links (optional).
-
#published ⇒ Object
Published (optional).
-
#rights ⇒ Object
rights (optional).
-
#source ⇒ Object
source (optional).
-
#summary ⇒ Object
Summary (optional).
-
#title ⇒ Object
Entry title (required).
-
#updated ⇒ Object
Entry update date (required).
Constructor Details
#initialize(node) ⇒ AtomFeedEntry
Returns a new instance of AtomFeedEntry.
6 7 8 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 6 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
4 5 6 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 4 def node @node end |
Instance Method Details
#authors ⇒ Object
Array of authors (optional).
26 27 28 29 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 26 def nodes = @node.xpath("atom:author", ::AtomFeed::NS) || [] nodes.map { |node| AtomPerson.new(node) } end |
#categories ⇒ Object
categories (optional)
52 53 54 55 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 52 def categories nodes = @node.xpath("atom:category", ::AtomFeed::NS) || [] nodes.map { |node| AtomCategory.new(node) } end |
#content ⇒ Object
Content (optional)
38 39 40 41 42 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 38 def content node = @node.at_xpath("atom:content", ::AtomFeed::NS) return nil unless node AtomText.new(node) end |
#contributors ⇒ Object
contributors (optional)
58 59 60 61 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 58 def contributors nodes = @node.xpath("atom:contributor", ::AtomFeed::NS) || [] nodes.map { |node| AtomPerson.new(node) } end |
#id ⇒ Object
Entry id (required).
11 12 13 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 11 def id @node.at_xpath("atom:id", ::AtomFeed::NS).content end |
#links ⇒ Object
Array of links (optional).
32 33 34 35 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 32 def links nodes = @node.xpath("atom:link", ::AtomFeed::NS) || [] nodes.map { |node| AtomLink.new(node) } end |
#published ⇒ Object
Published (optional)
64 65 66 67 68 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 64 def published time = @node.at_xpath("atom:published", ::AtomFeed::NS).try(:content) return nil unless time Time.parse(time) end |
#rights ⇒ Object
rights (optional)
78 79 80 81 82 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 78 def rights node = @node.at_xpath("atom:rights", ::AtomFeed::NS) return nil unless node AtomText.new(node) end |
#source ⇒ Object
source (optional)
71 72 73 74 75 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 71 def source if node = @node.at_xpath("atom:source", ::AtomFeed::NS) AtomFeedEntry.new(node) end end |
#summary ⇒ Object
Summary (optional)
45 46 47 48 49 |
# File 'lib/atom_feed/atom_feed_entry.rb', line 45 def summary node = @node.at_xpath("atom:summary", ::AtomFeed::NS) return nil unless node AtomText.new(node) end |