<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -39,55 +39,18 @@ end
 get '/main.rss' do
   content_type &quot;application/rss+xml&quot;
 
-  url = &quot;#{@@db}/_design/meals/_view/by_date?limit=10&amp;descending=true&quot;
-  data = RestClient.get url
-  @meal_view = JSON.parse(data)['rows']
-
-  rss = RSS::Maker.make(&quot;2.0&quot;) do |maker|
-    maker.channel.title = &quot;EEE Cooks: Meals&quot;
-    maker.channel.link  = ROOT_URL
-    maker.channel.description = &quot;Meals from a Family Cookbook&quot;
-    @meal_view.each do |couch_rec|
-      data = RestClient.get &quot;#{@@db}/#{couch_rec['key']}&quot;
-      meal = JSON.parse(data)
-      date = Date.parse(meal['date'])
-      maker.items.new_item do |item|
-        item.link = ROOT_URL + date.strftime(&quot;/meals/%Y/%m/%d&quot;)
-        item.title = meal['title']
-        item.pubDate = Time.parse(meal['date'])
-        item.description = meal['summary']
-      end
-    end
+  rss_for_date_view(&quot;meals&quot;) do |rss_item, meal|
+    date = Date.parse(meal['date'])
+    rss_item.link = ROOT_URL + date.strftime(&quot;/meals/%Y/%m/%d&quot;)
   end
-
-  rss.to_s
 end
 
 get '/recipes.rss' do
   content_type &quot;application/rss+xml&quot;
 
-  url = &quot;#{@@db}/_design/recipes/_view/by_date?limit=10&amp;descending=true&quot;
-  data = RestClient.get url
-  @recipe_view = JSON.parse(data)['rows']
-
-  rss = RSS::Maker.make(&quot;2.0&quot;) do |maker|
-    maker.channel.title = &quot;EEE Cooks: Recipes&quot;
-    maker.channel.link  = ROOT_URL
-    maker.channel.description = &quot;Recipes from a Family Cookbook&quot;
-
-    @recipe_view.each do |couch_rec|
-      data = RestClient.get &quot;#{@@db}/#{couch_rec['value'][0]}&quot;
-      recipe = JSON.parse(data)
-      maker.items.new_item do |item|
-        item.link = ROOT_URL + &quot;/recipes/recipe['id']&quot;
-        item.title = recipe['title']
-        item.pubDate = Time.parse(recipe['date'])
-        item.description = recipe['summary']
-      end
-    end
+  rss_for_date_view(&quot;recipes&quot;) do |rss_item, recipe|
+    rss_item.link = ROOT_URL + &quot;/recipes/#{recipe['id']}&quot;
   end
-
-  rss.to_s
 end
 
 get %r{/meals/(\d+)/(\d+)/(\d+)} do |year, month, day|</diff>
      <filename>eee.rb</filename>
    </modified>
    <modified>
      <diff>@@ -194,5 +194,31 @@ module Eee
 
       crumbs.join(&quot; &amp;gt; &quot;)
     end
+
+    def rss_for_date_view(feed)
+      url = &quot;#{_db}/_design/#{feed}/_view/by_date?limit=10&amp;descending=true&quot;
+      data = RestClient.get url
+      view = JSON.parse(data)['rows']
+
+      rss = RSS::Maker.make(&quot;2.0&quot;) do |maker|
+        maker.channel.title = &quot;EEE Cooks: #{feed.capitalize}&quot;
+        maker.channel.link  = ROOT_URL
+        maker.channel.description = &quot;#{feed.capitalize} from a Family Cookbook&quot;
+
+        view.each do |couch_rec|
+          data = RestClient.get &quot;#{_db}/#{couch_rec['value'][0]}&quot;
+          record = JSON.parse(data)
+          maker.items.new_item do |item|
+            item.title = record['title']
+            item.pubDate = Time.parse(record['date'])
+            item.description = record['summary']
+
+            yield item, record
+          end
+        end
+      end
+
+      rss.to_s
+    end
   end
 end</diff>
      <filename>helpers.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2d66d09c0011a7addc964f0ab02955a1f81e0350</id>
    </parent>
  </parents>
  <author>
    <name>eee-c</name>
    <login>eee-c</login>
    <email>eee.c@eeecooks.com</email>
  </author>
  <url>http://github.com/eee-c/eee-code/commit/c76dbb82193fca9f19d734a014959e7905d088a2</url>
  <id>c76dbb82193fca9f19d734a014959e7905d088a2</id>
  <committed-date>2009-07-04T11:19:08-07:00</committed-date>
  <authored-date>2009-07-04T11:19:08-07:00</authored-date>
  <message>DRY up those RSS feeds</message>
  <tree>82b2195c12cfb7dc0d1418babf4633b4abdd9213</tree>
  <committer>
    <name>eee-c</name>
    <login>eee-c</login>
    <email>eee.c@eeecooks.com</email>
  </committer>
</commit>
