Class: FeedParser::Feed

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFeed

Returns a new instance of Feed.



77
78
79
80
81
82
83
84
# File 'lib/feedparser/feed.rb', line 77

def initialize
  ## note: make items, authors, tags empty arrays on startup (e.g. not nil)
  @items   = []
  @authors = []
  @tags    = []

  @generator = Generator.new
end

Instance Attribute Details

#authorsObject

Returns the value of attribute authors.



15
16
17
# File 'lib/feedparser/feed.rb', line 15

def authors
  @authors
end

#feed_urlObject

Returns the value of attribute feed_url.



10
11
12
# File 'lib/feedparser/feed.rb', line 10

def feed_url
  @feed_url
end

#formatObject

e.g. atom|rss 2.0|json etc.



7
8
9
# File 'lib/feedparser/feed.rb', line 7

def format
  @format
end

#generatorObject

Returns the value of attribute generator.



70
71
72
# File 'lib/feedparser/feed.rb', line 70

def generator
  @generator
end

#itemsObject

Returns the value of attribute items.



13
14
15
# File 'lib/feedparser/feed.rb', line 13

def items
  @items
end

#publishedObject

e.g. pubDate (rss)n/a (atom) – note: published is basically an alias for created



63
64
65
# File 'lib/feedparser/feed.rb', line 63

def published
  @published
end

#published_localObject

“unparsed” local datetime as in feed (NOT converted to utc)



64
65
66
# File 'lib/feedparser/feed.rb', line 64

def published_local
  @published_local
end

#published_textObject Also known as: published_line

string version of date



66
67
68
# File 'lib/feedparser/feed.rb', line 66

def published_text
  @published_text
end

#summaryObject Also known as: description, subtitle

e.g. description (rss)|subtitle (atom)



33
34
35
# File 'lib/feedparser/feed.rb', line 33

def summary
  @summary
end

#tagsObject Also known as: categories

Returns the value of attribute tags.



25
26
27
# File 'lib/feedparser/feed.rb', line 25

def tags
  @tags
end

#titleObject

Returns the value of attribute title.



8
9
10
# File 'lib/feedparser/feed.rb', line 8

def title
  @title
end

#updatedObject

e.g. lastBuildDate (rss)|updated (atom) – always (converted) to utc



56
57
58
# File 'lib/feedparser/feed.rb', line 56

def updated
  @updated
end

#updated_localObject

“unparsed” local datetime as in feed (NOT converted to utc)



57
58
59
# File 'lib/feedparser/feed.rb', line 57

def updated_local
  @updated_local
end

#updated_textObject Also known as: updated_line

string version of date



59
60
61
# File 'lib/feedparser/feed.rb', line 59

def updated_text
  @updated_text
end

#urlObject

todo - add alias site_url/home_page_url/page_url - why? why not??



9
10
11
# File 'lib/feedparser/feed.rb', line 9

def url
  @url
end

Instance Method Details

#authorObject

add author shortcut e.g. equals authors - for now only read only

fix: also add author=  why? why not???


22
# File 'lib/feedparser/feed.rb', line 22

def author() @authors[0]; end

#authors?Boolean Also known as: author?

Returns:

  • (Boolean)


16
# File 'lib/feedparser/feed.rb', line 16

def authors?()  @authors && @authors.size > 0;  end

#published?Boolean

Returns:

  • (Boolean)


62
# File 'lib/feedparser/feed.rb', line 62

def published?()  @published.nil? == false;  end

#summary?Boolean Also known as: description?, subtitle?

Returns:

  • (Boolean)


32
# File 'lib/feedparser/feed.rb', line 32

def summary?()  @summary.nil? == false;  end

#tags?Boolean

Returns:

  • (Boolean)


26
# File 'lib/feedparser/feed.rb', line 26

def tags?()  @tags && @tags.size > 0;  end

#updated?Boolean

Returns:

  • (Boolean)


55
# File 'lib/feedparser/feed.rb', line 55

def updated?()  @updated.nil? == false;  end