Class: FeedParser::Item

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeItem


99
100
101
102
103
104
# File 'lib/feedparser/item.rb', line 99

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

Instance Attribute Details

#attachmentsObject Also known as: enclosures

add attachments/media enclosures (url, length and type)

note: lets support more than one (it's an array)

87
88
89
# File 'lib/feedparser/item.rb', line 87

def attachments
  @attachments
end

#authorsObject

Returns the value of attribute authors


67
68
69
# File 'lib/feedparser/item.rb', line 67

def authors
  @authors
end

#contentObject Also known as: content_html

Returns the value of attribute content


21
22
23
# File 'lib/feedparser/item.rb', line 21

def content
  @content
end

#content_textObject

Returns the value of attribute content_text


31
32
33
# File 'lib/feedparser/item.rb', line 31

def content_text
  @content_text
end

#external_urlObject Also known as: related_url

Returns the value of attribute external_url


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

def external_url
  @external_url
end

#idObject Also known as: guid

Returns the value of attribute id


61
62
63
# File 'lib/feedparser/item.rb', line 61

def id
  @id
end

#publishedObject

note: published is basically an alias for created


54
55
56
# File 'lib/feedparser/item.rb', line 54

def published
  @published
end

#published_localObject

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


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

def published_local
  @published_local
end

#published_textObject Also known as: published_line

string version of date


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

def published_text
  @published_text
end

#summaryObject Also known as: description

Returns the value of attribute summary


36
37
38
# File 'lib/feedparser/item.rb', line 36

def summary
  @summary
end

#tagsObject Also known as: categories

Returns the value of attribute tags


79
80
81
# File 'lib/feedparser/item.rb', line 79

def tags
  @tags
end

#titleObject

Returns the value of attribute title


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

def title
  @title
end

#updatedObject

pubDate (RSS)|updated (Atom)


46
47
48
# File 'lib/feedparser/item.rb', line 46

def updated
  @updated
end

#updated_localObject

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


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

def updated_local
  @updated_local
end

#updated_textObject Also known as: updated_line

string version of date


49
50
51
# File 'lib/feedparser/item.rb', line 49

def updated_text
  @updated_text
end

#urlObject

Returns the value of attribute url


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

def url
  @url
end

Instance Method Details

#attachmentObject Also known as: enclosure


89
# File 'lib/feedparser/item.rb', line 89

def attachment()    @attachments[0]; end

#attachments?Boolean Also known as: attachment?, enclosures?, enclosure?


90
# File 'lib/feedparser/item.rb', line 90

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

#authorObject

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

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

76
# File 'lib/feedparser/item.rb', line 76

def author() @authors[0]; end

#authors?Boolean Also known as: author?

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

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

70
# File 'lib/feedparser/item.rb', line 70

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

#content?Boolean Also known as: content_html?


20
# File 'lib/feedparser/item.rb', line 20

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

#content_text?Boolean


30
# File 'lib/feedparser/item.rb', line 30

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

#published?Boolean


53
# File 'lib/feedparser/item.rb', line 53

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

#summary?Boolean Also known as: description?


35
# File 'lib/feedparser/item.rb', line 35

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

#tags?Boolean


80
# File 'lib/feedparser/item.rb', line 80

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

#updated?Boolean


45
# File 'lib/feedparser/item.rb', line 45

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