Class: FeedParser::AtomItem

Inherits:
FeedItem show all
Defined in:
lib/feed_parser/feed_item.rb

Instance Attribute Summary

Attributes inherited from FeedItem

#type

Instance Method Summary collapse

Methods inherited from FeedItem

#as_json, #method_missing

Constructor Details

#initialize(item) ⇒ AtomItem

Returns a new instance of AtomItem.



77
78
79
80
81
82
83
# File 'lib/feed_parser/feed_item.rb', line 77

def initialize(item)
  @type = :atom
  super
  @link = item.xpath(Dsl[@type][:item_link]).attribute("href").text.strip
  @updated = parse_datetime(item.xpath(Dsl[@type][:item_updated]).text)
  @categories = item.xpath(Dsl[@type][:item_categories]).map{|cat| cat.attribute("term").text}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FeedParser::FeedItem

Instance Method Details

#publishedObject



85
86
87
# File 'lib/feed_parser/feed_item.rb', line 85

def published
  @published ||= @updated
end