Class: YYFeed::Feed

Inherits:
Object
  • Object
show all
Defined in:
lib/YYFeed.rb

Overview

rss2.0 & rss1.0 & atom specs are integrated within this class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFeed

Returns a new instance of Feed.



20
21
22
23
# File 'lib/YYFeed.rb', line 20

def initialize
  @content = nil
  @items = Array.new
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



18
19
20
# File 'lib/YYFeed.rb', line 18

def content
  @content
end

#itemsObject

Returns the value of attribute items.



18
19
20
# File 'lib/YYFeed.rb', line 18

def items
  @items
end

Instance Method Details

#descriptionObject



41
42
43
44
45
46
47
# File 'lib/YYFeed.rb', line 41

def description
  if @content.feed_type == "atom"
    return ""
  elsif @content.feed_type == "rss"
    return @content.channel.description
  end
end


33
34
35
36
37
38
39
# File 'lib/YYFeed.rb', line 33

def link
  if @content.feed_type == "atom"
    return @content.link.href
  elsif @content.feed_type == "rss"
    return @content.channel.link
  end
end

#titleObject



25
26
27
28
29
30
31
# File 'lib/YYFeed.rb', line 25

def title
  if @content.feed_type == "atom"
    return @content.title.content
  elsif @content.feed_type == "rss"
    return @content.channel.title
  end
end