What's new in the RSS_creator gem version 0.2.2
require 'rss_creator'
rss = RSScreator.new 'feed.rss'
item = {
title: 'Monday: windy in the morning',
link: 'http://www.yourwebsite.com/2015/oct/26/',
description: 'In the east of Edinburgh, wind is expected in the ' + \
'morning with a minimum temperature of 9 degrees Celcius'
}
rss.add item
rss.save
Output:
<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
<channel>
<title>The Edinburgh Weather forecast feed</title>
<description>Weather data fetched from forecast.io</description>
<item>
<title>Monday: windy in the morning</title>
<description>In the east of Edinburgh, wind is expected in the morning wit
h a minimum temperature of 9 degrees Celcius</description>
<link>http://www.yourwebsite.com/2015/oct/26/</link>
<pubDate>Sun, 25 Oct 2015 10:16:00 +0000</pubDate>
</item>
<item>
<title>Sunday: Drizzle in the morning</title>
<description>In the east of Edinburgh, drizzle is expected in the morning
with a minimum temperature of 6 degrees Celcius</description>
<link>http://www.yourwebsite.com/2015/oct/25/#8am</link>
<pubDate>Sun, 24 Oct 2015 09:21:21 +0000</pubDate>
</item>
</channel>
</rss>
As you can see above, in this version of the RSS_creator gem an existing RSS file be opened and an entry appended to it. Notice the latest entry appears at the top.
Introducing the RSS_creator gem
require 'rss_creator'
rss = RSScreator.new
rss.title = 'The Edinburgh Weather forecast feed'
rss.desc = 'Weather data fetched from forecast.io'
item = {
title: 'Tuesday: Drizzle in the morning',
link: 'http://www.yourwebsite.com/2015/oct/24/#8am',
description: 'In the east of Edinburgh, drizzle is expected in the ' + \
'morning with a minimum temperature of 6 degrees Celcius'
}
rss.add item
rss.save 'feed.rss'
Output:
<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
<channel>
<title>The Edinburgh Weather forecast feed</title>
<description>Weather data fetched from forecast.io</description>
<item>
<title>Tuesday: Drizzle in the morning</title>
<description>In the east of Edinburgh, drizzle is expected in the morning
with a minimum temperature of 6 degrees Celcius</description>
<link>http://www.yourwebsite.com/2015/oct/24/#8am</link>
<pubDate>Sat, 24 Oct 2015 22:40:10 +0100</pubDate>
</item>
</channel>
</rss>
Resources
- rss_creator https://rubygems.org/gems/rss_creator
rss_creator rss dynarex gem