Class: FeedParser::Item
- Inherits:
-
Object
- Object
- FeedParser::Item
- Defined in:
- lib/feedparser/item.rb
Instance Attribute Summary collapse
-
#attachments ⇒ Object
(also: #enclosures)
add attachments/media enclosures (url, length and type) note: lets support more than one (it’s an array).
-
#authors ⇒ Object
Returns the value of attribute authors.
-
#content ⇒ Object
(also: #content_html)
Returns the value of attribute content.
-
#content_text ⇒ Object
Returns the value of attribute content_text.
-
#external_url ⇒ Object
(also: #related_url)
Returns the value of attribute external_url.
-
#id ⇒ Object
(also: #guid)
Returns the value of attribute id.
-
#published ⇒ Object
note: published is basically an alias for created.
-
#published_local ⇒ Object
“unparsed” local datetime as in feed (NOT converted to utc).
-
#published_text ⇒ Object
(also: #published_line)
string version of date.
-
#summary ⇒ Object
(also: #description)
Returns the value of attribute summary.
-
#tags ⇒ Object
(also: #categories)
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updated ⇒ Object
pubDate (RSS)|updated (Atom).
-
#updated_local ⇒ Object
“unparsed” local datetime as in feed (NOT converted to utc).
-
#updated_text ⇒ Object
(also: #updated_line)
string version of date.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #attachment ⇒ Object (also: #enclosure)
- #attachments? ⇒ Boolean (also: #attachment?, #enclosures?, #enclosure?)
-
#author ⇒ Object
add author shortcut e.g.
-
#authors? ⇒ Boolean
(also: #author?)
add author shortcut e.g.
- #content? ⇒ Boolean (also: #content_html?)
- #content_text? ⇒ Boolean
-
#initialize ⇒ Item
constructor
A new instance of Item.
- #published? ⇒ Boolean
- #summary? ⇒ Boolean (also: #description?)
- #tags? ⇒ Boolean
- #updated? ⇒ Boolean
Constructor Details
#initialize ⇒ Item
Returns a new instance of Item.
99 100 101 102 103 104 |
# File 'lib/feedparser/item.rb', line 99 def initialize ## note: make authors, tags empty arrays on startup (e.g. not nil) @authors = [] @tags = [] @attachments = [] end |
Instance Attribute Details
#attachments ⇒ Object Also known as: enclosures
add attachments/media enclosures (url, length and type)
note: lets support more than one (it's an array)
87 88 89 |
# File 'lib/feedparser/item.rb', line 87 def @attachments end |
#authors ⇒ Object
Returns the value of attribute authors.
67 68 69 |
# File 'lib/feedparser/item.rb', line 67 def @authors end |
#content ⇒ Object Also known as: content_html
Returns the value of attribute content.
21 22 23 |
# File 'lib/feedparser/item.rb', line 21 def content @content end |
#content_text ⇒ Object
Returns the value of attribute content_text.
31 32 33 |
# File 'lib/feedparser/item.rb', line 31 def content_text @content_text end |
#external_url ⇒ Object Also known as:
Returns the value of attribute external_url.
9 10 11 |
# File 'lib/feedparser/item.rb', line 9 def external_url @external_url end |
#id ⇒ Object Also known as: guid
Returns the value of attribute id.
61 62 63 |
# File 'lib/feedparser/item.rb', line 61 def id @id end |
#published ⇒ Object
note: published is basically an alias for created
54 55 56 |
# File 'lib/feedparser/item.rb', line 54 def published @published end |
#published_local ⇒ Object
“unparsed” local datetime as in feed (NOT converted to utc)
55 56 57 |
# File 'lib/feedparser/item.rb', line 55 def published_local @published_local end |
#published_text ⇒ Object Also known as: published_line
string version of date
57 58 59 |
# File 'lib/feedparser/item.rb', line 57 def published_text @published_text end |
#summary ⇒ Object Also known as: description
Returns the value of attribute summary.
36 37 38 |
# File 'lib/feedparser/item.rb', line 36 def summary @summary end |
#tags ⇒ Object Also known as: categories
Returns the value of attribute tags.
79 80 81 |
# File 'lib/feedparser/item.rb', line 79 def @tags end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/feedparser/item.rb', line 7 def title @title end |
#updated ⇒ Object
pubDate (RSS)|updated (Atom)
46 47 48 |
# File 'lib/feedparser/item.rb', line 46 def updated @updated end |
#updated_local ⇒ Object
“unparsed” local datetime as in feed (NOT converted to utc)
47 48 49 |
# File 'lib/feedparser/item.rb', line 47 def updated_local @updated_local end |
#updated_text ⇒ Object Also known as: updated_line
string version of date
49 50 51 |
# File 'lib/feedparser/item.rb', line 49 def updated_text @updated_text end |
#url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/feedparser/item.rb', line 8 def url @url end |
Instance Method Details
#attachment ⇒ Object Also known as: enclosure
89 |
# File 'lib/feedparser/item.rb', line 89 def () @attachments[0]; end |
#attachments? ⇒ Boolean Also known as: attachment?, enclosures?, enclosure?
90 |
# File 'lib/feedparser/item.rb', line 90 def () @attachments && @attachments.size > 0; end |
#author ⇒ Object
add author shortcut e.g. equals authors - for now only read only
fix: also add author= why? why not???
76 |
# File 'lib/feedparser/item.rb', line 76 def () @authors[0]; end |
#authors? ⇒ Boolean Also known as:
add author shortcut e.g. equals authors - for now only read only
fix: also add author= why? why not???
70 |
# File 'lib/feedparser/item.rb', line 70 def () @authors && @authors.size > 0; end |
#content? ⇒ Boolean Also known as: content_html?
20 |
# File 'lib/feedparser/item.rb', line 20 def content?() @content.nil? == false; end |
#content_text? ⇒ Boolean
30 |
# File 'lib/feedparser/item.rb', line 30 def content_text?() @content_text.nil? == false; end |
#published? ⇒ Boolean
53 |
# File 'lib/feedparser/item.rb', line 53 def published?() @published.nil? == false; end |
#summary? ⇒ Boolean Also known as: description?
35 |
# File 'lib/feedparser/item.rb', line 35 def summary?() @summary.nil? == false; end |
#tags? ⇒ Boolean
80 |
# File 'lib/feedparser/item.rb', line 80 def () @tags && @tags.size > 0; end |
#updated? ⇒ Boolean
45 |
# File 'lib/feedparser/item.rb', line 45 def updated?() @updated.nil? == false; end |