Class: WordpRSS::Item
- Inherits:
-
Object
- Object
- WordpRSS::Item
- Defined in:
- lib/wordprss/item.rb
Instance Method Summary collapse
-
#creator ⇒ String
Returns item author.
-
#description ⇒ String
Returns the item description.
-
#initialize(node) ⇒ Item
constructor
A new instance of Item.
-
#link ⇒ String
Returns the item link.
-
#published_at ⇒ String
Returns the item publication date.
-
#tags ⇒ Array<String>
Returns an array of the item categories.
-
#title ⇒ String
Returns the item title.
Constructor Details
#initialize(node) ⇒ Item
Returns a new instance of Item.
3 4 5 |
# File 'lib/wordprss/item.rb', line 3 def initialize(node) @node = node end |
Instance Method Details
#creator ⇒ String
Returns item author
45 46 47 48 |
# File 'lib/wordprss/item.rb', line 45 def creator creator_node = node.elements.last.children.find { |c| c.name == "dc:creator" } creator_node.text if !creator_node.nil? end |
#description ⇒ String
Returns the item description
31 32 33 |
# File 'lib/wordprss/item.rb', line 31 def description node.at("description").text end |
#link ⇒ String
Returns the item link
17 18 19 |
# File 'lib/wordprss/item.rb', line 17 def link node.at("link").text end |
#published_at ⇒ String
Returns the item publication date
24 25 26 |
# File 'lib/wordprss/item.rb', line 24 def published_at node.at("pubDate").text end |
#tags ⇒ Array<String>
Returns an array of the item categories
38 39 40 |
# File 'lib/wordprss/item.rb', line 38 def node.css("category").map(&:text) end |
#title ⇒ String
Returns the item title
10 11 12 |
# File 'lib/wordprss/item.rb', line 10 def title node.at("title").text end |