Class: NewsFireExport::Feed
- Inherits:
-
Object
- Object
- NewsFireExport::Feed
- Defined in:
- lib/newsfire_export.rb
Overview
Representation of a feed that also holds everything that is needed for the OPML outline output
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#htmlurl ⇒ Object
readonly
Returns the value of attribute htmlurl.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#xmlurl ⇒ Object
readonly
Returns the value of attribute xmlurl.
Instance Method Summary collapse
-
#get_key ⇒ Object
Tries to emulate the xmlUrl->filename conversion done by NewsFire.
-
#initialize(hash, feedlist) ⇒ Feed
constructor
A new instance of Feed.
-
#to_s ⇒ Object
Generates by default an OPML outline or “” if the feedname starts with an underscore and filtering is enabled.
Constructor Details
#initialize(hash, feedlist) ⇒ Feed
Returns a new instance of Feed.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/newsfire_export.rb', line 49 def initialize hash,feedlist if hash['address'].nil? pp hash raise "Not a feed" end @feedlist=feedlist @description = hash['comment'] @xmlurl=hash['address'] @htmlurl=hash['link'] @name=hash['name'] if @name.nil? raise NoNameException,"#{xmlurl} has no name" @name=@xmlurl end end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
48 49 50 |
# File 'lib/newsfire_export.rb', line 48 def description @description end |
#htmlurl ⇒ Object (readonly)
Returns the value of attribute htmlurl.
48 49 50 |
# File 'lib/newsfire_export.rb', line 48 def htmlurl @htmlurl end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
48 49 50 |
# File 'lib/newsfire_export.rb', line 48 def name @name end |
#xmlurl ⇒ Object (readonly)
Returns the value of attribute xmlurl.
48 49 50 |
# File 'lib/newsfire_export.rb', line 48 def xmlurl @xmlurl end |
Instance Method Details
#get_key ⇒ Object
Tries to emulate the xmlUrl->filename conversion done by NewsFire
73 74 75 |
# File 'lib/newsfire_export.rb', line 73 def get_key @xmlurl.gsub(/^http:\/\//,'').gsub(/^www\./,'').gsub(/\//,'-').gsub('?','-') end |
#to_s ⇒ Object
Generates by default an OPML outline or “” if the feedname starts with an underscore and filtering is enabled
67 68 69 70 |
# File 'lib/newsfire_export.rb', line 67 def to_s return "" if @feedlist.filter and @name=~/^_/ to_opml end |