Class: FeedAbstract::Channel::Atom

Inherits:
Object
  • Object
show all
Includes:
FeedAbstractMixins::Atom
Defined in:
lib/feed-abstract/channel/atom.rb

Overview

See FeedAbstractMixins::Atom for more instance methods.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FeedAbstractMixins::Atom

#author, #authors, #categories, #category, #guid, #link, #rights, #title, #updated

Constructor Details

#initialize(feed) ⇒ Atom

Returns a new instance of Atom.



14
15
16
# File 'lib/feed-abstract/channel/atom.rb', line 14

def initialize(feed)
  @feed = @source = feed
end

Instance Attribute Details

#feedObject (readonly)

Returns the value of attribute feed.



12
13
14
# File 'lib/feed-abstract/channel/atom.rb', line 12

def feed
  @feed
end

#sourceObject (readonly)

Returns the value of attribute source.



12
13
14
# File 'lib/feed-abstract/channel/atom.rb', line 12

def source
  @source
end

Instance Method Details

#descriptionObject Also known as: subtitle



23
24
25
26
# File 'lib/feed-abstract/channel/atom.rb', line 23

def description
  return '' if @feed.subtitle.nil? && @feed.tagline.nil?
  (@feed.subtitle.nil?) ? @feed.tagline.content : @feed.subtitle.content
end

#generatorObject

A string representing the application that created this feed.



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/feed-abstract/channel/atom.rb', line 30

def generator
  if self.link.match(/zotero\.org/)
    return 'Zotero'
  elsif self.link.match(/wordpress\.com/)
    return 'WordPress'
  elsif self.link.match(/https?:\/\/.*\.?twitter\.com/i)
    return 'Twitter'
  end
  return '' if @feed.generator.nil?
  @feed.generator.content
end

#iconObject

A URL (perhaps with domain, depending on input) representing an icon for the feed.



43
44
45
46
# File 'lib/feed-abstract/channel/atom.rb', line 43

def icon
  return '' if @feed.icon.nil?
  @feed.icon.content
end

#languageObject



18
19
20
21
# File 'lib/feed-abstract/channel/atom.rb', line 18

def language
  return '' if @feed.lang.nil?
  @feed.lang
end

#logoObject

A URL (perhaps with domain, depending on input) representing a logo for the feed.



49
50
51
52
# File 'lib/feed-abstract/channel/atom.rb', line 49

def 
  return '' if @feed..nil?
  @feed..content
end