Class: Fede::XMLFeed
- Inherits:
-
Object
- Object
- Fede::XMLFeed
- Defined in:
- lib/fede/xml_feed.rb
Instance Attribute Summary collapse
-
#nodes ⇒ Object
Returns the value of attribute nodes.
Instance Method Summary collapse
- #footer ⇒ Object
- #header ⇒ Object
-
#initialize(nodes = []) ⇒ XMLFeed
constructor
A new instance of XMLFeed.
- #to_s ⇒ Object
Constructor Details
#initialize(nodes = []) ⇒ XMLFeed
Returns a new instance of XMLFeed.
5 6 7 |
# File 'lib/fede/xml_feed.rb', line 5 def initialize(nodes = []) @nodes = nodes end |
Instance Attribute Details
#nodes ⇒ Object
Returns the value of attribute nodes.
3 4 5 |
# File 'lib/fede/xml_feed.rb', line 3 def nodes @nodes end |
Instance Method Details
#footer ⇒ Object
15 16 17 |
# File 'lib/fede/xml_feed.rb', line 15 def "</rss>\n" end |
#header ⇒ Object
9 10 11 12 13 |
# File 'lib/fede/xml_feed.rb', line 9 def header "<?xml version='1.0' encoding='UTF-8'?>\n<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'"\ " xmlns:cc='http://web.resource.org/cc/' xmlns:itunes='http://www.itunes.com/dtds/podcast-1.0.dtd'"\ " xmlns:media='http://search.yahoo.com/mrss/' xmlns:content='http://purl.org/rss/1.0/modules/content/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>\n" end |
#to_s ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/fede/xml_feed.rb', line 19 def to_s '' unless @nodes nodes_string = @nodes.reduce('') do |prev, node| "#{prev}#{node.to_s(1)}" end "#{header}#{nodes_string}#{footer}" end |