Module: FeedAbstractMixins::Atom
- Included in:
- FeedAbstract::Channel::Atom, FeedAbstract::Item::Atom
- Defined in:
- lib/feed-abstract/mixins.rb
Overview
Instance methods shared between FeedAbstract::Channel::Atom and FeedAbstract::Item::Atom
Instance Method Summary collapse
-
#author ⇒ Object
The authors list as a string, joined with a comma.
-
#authors ⇒ Object
An array of author names.
-
#categories ⇒ Object
The categories list as an array.
-
#category ⇒ Object
The categories list as a string joined with a comma.
-
#guid ⇒ Object
A globally unique ID to this resource, usually (but not always) a URL.
- #link ⇒ Object
-
#rights ⇒ Object
Copyright info.
- #title ⇒ Object
-
#updated ⇒ Object
A Time object representing when resource was updated.
Instance Method Details
#author ⇒ Object
The authors list as a string, joined with a comma.
48 49 50 51 |
# File 'lib/feed-abstract/mixins.rb', line 48 def return '' if self..empty? self..join(', ') end |
#authors ⇒ Object
An array of author names
39 40 41 42 43 44 45 |
# File 'lib/feed-abstract/mixins.rb', line 39 def if self.respond_to?(:channel) && self.channel.generator == 'Twitter' return [@source..name.content.split(' ')[0]] end return [] if @source..empty? @source..collect{|au| au.name.content}.reject{|au| au == '' || au.match(/^\s+$/)} end |
#categories ⇒ Object
The categories list as an array.
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/feed-abstract/mixins.rb', line 54 def categories if self.respond_to?(:channel) && self.channel.generator == 'Twitter' return @source.title.content.scan(/#([^#\s]+)/).flatten end return [] if @source.categories.empty? && @source.dc_subjects.empty? tmp_cats = [] tmp_cats << @source.categories.collect{|c| c.term} tmp_cats << @source.dc_subjects.collect{|c| c.content} tmp_cats.flatten.reject{|c| c == '' || c.match(/^\s+$/)} end |
#category ⇒ Object
The categories list as a string joined with a comma.
67 68 69 70 |
# File 'lib/feed-abstract/mixins.rb', line 67 def category return '' if self.categories.empty? self.categories.join(', ') end |
#guid ⇒ Object
A globally unique ID to this resource, usually (but not always) a URL.
21 22 23 24 |
# File 'lib/feed-abstract/mixins.rb', line 21 def guid return '' if @source.id.nil? @source.id.content end |
#link ⇒ Object
15 16 17 18 |
# File 'lib/feed-abstract/mixins.rb', line 15 def link return '' if @source.link.nil? @source.link.href end |
#rights ⇒ Object
Copyright info.
33 34 35 36 |
# File 'lib/feed-abstract/mixins.rb', line 33 def rights return '' if @source.rights.nil? @source.rights.content end |
#title ⇒ Object
11 12 13 |
# File 'lib/feed-abstract/mixins.rb', line 11 def title @source.title.content end |
#updated ⇒ Object
A Time object representing when resource was updated.
27 28 29 30 |
# File 'lib/feed-abstract/mixins.rb', line 27 def updated return '' if @source.updated.nil? && @source.modified.nil? (@source.updated.nil?) ? @source.modified.content : @source.updated.content end |