Class: RssFeed::Feed::Item

Inherits:
Base show all
Defined in:
lib/rss_feed/feed/item.rb

Overview

The Item class represents an item in an RSS feed.

Constant Summary collapse

TAGS =

List of commonly used tags in an RSS item.

%w[
  id
  title link link+alternate link+self link+edit link+replies
  author contributor
  description summary content content:encoded comments
  pubDate published updated expirationDate modified dc:date
  category guid
  trackback:ping trackback:about
  dc:creator dc:title dc:subject dc:rights dc:publisher
  feedburner:origLink media:content media:thumbnail
  media:title
  media:credit
  media:category
].freeze

Instance Attribute Summary

Attributes inherited from Base

#document

Instance Method Summary collapse

Methods inherited from Base

#detect_feed_type, #execute_method, #initialize, #parser

Constructor Details

This class inherits a constructor from RssFeed::Feed::Base

Instance Method Details

#atom ⇒ Object Also known as: feed

XPath expression for selecting the Atom entry.



29
30
31
# File 'lib/rss_feed/feed/item.rb', line 29

def atom
  '//xmlns:entry'
end

#parse ⇒ Nokogiri::XML::NodeSet

Parses the RSS item or Atom entry based on the detected feed type.

Returns:

  • (Nokogiri::XML::NodeSet) —

    The parsed item or entry.



37
38
39
# File 'lib/rss_feed/feed/item.rb', line 37

def parse
  document.xpath(execute_method)
end

#rss ⇒ Object

XPath expression for selecting the RSS item.



24
25
26
# File 'lib/rss_feed/feed/item.rb', line 24

def rss
  '//item'
end