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.



62
63
64
65
66
67
68
69
# File 'lib/feedparser/feed.rb', line 62

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.



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

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



51
52
53
# File 'lib/feedparser/feed.rb', line 51

def published
  @published
end

#published_localObject

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



52
53
54
# File 'lib/feedparser/feed.rb', line 52

def published_local
  @published_local
end

#summaryObject Also known as: subtitle

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



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

def summary
  @summary
end

#tagsObject

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



47
48
49
# File 'lib/feedparser/feed.rb', line 47

def updated
  @updated
end

#updated_localObject

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



48
49
50
# File 'lib/feedparser/feed.rb', line 48

def updated_local
  @updated_local
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)


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

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

#summary?Boolean Also known as: subtitle?

Returns:

  • (Boolean)


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

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)


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

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