<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -507,7 +507,7 @@ module Atom # :nodoc:
         @attrs
       end
 
-      self.class.initters do |init|
+      self.class.run_initters do |init|
         self.instance_eval &amp;init
       end
 
@@ -521,9 +521,8 @@ module Atom # :nodoc:
       @on_init &lt;&lt; block
     end
 
-    def self.initters &amp;block
-      @on_init ||= []
-      @on_init.each &amp;block
+    def self.run_initters &amp;block
+      @on_init.each(&amp;block) if @on_init
     end
 
     # appends an element named 'name' in namespace 'ns' to 'root'
@@ -644,4 +643,43 @@ module Atom # :nodoc:
   class Contributor &lt; Atom::Person
     is_atom_element :contributor
   end
+
+  module HasLinks
+    def HasLinks.included(klass)
+      klass.atom_elements :link, :links, Atom::Link
+    end
+
+    def find_link(criteria)
+      self.links.find do |l|
+        criteria.all? { |k,v| l.send(k) == v }
+      end
+    end
+  end
+
+  module HasCategories
+    def HasCategories.included(klass)
+      klass.atom_elements :category, :categories, Atom::Category
+    end
+
+    # categorize the entry with each of an array or a space-separated
+    #   string
+    def tag_with(tags, delimiter = ' ')
+      return if not tags or tags.empty?
+
+      tag_list = unless tags.is_a?(String)
+                   tags
+                 else
+                   tags = tags.split(delimiter)
+                   tags.map! { |t| t.strip }
+                   tags.reject! { |t| t.empty? }
+                   tags.uniq
+                 end
+
+      tag_list.each do |tag|
+        unless categories.any? { |c| c.term == tag }
+          categories.new :term =&gt; tag
+        end
+      end
+    end
+  end
 end</diff>
      <filename>lib/atom/element.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,21 @@ require &quot;rexml/document&quot;
 require &quot;atom/element&quot;
 require &quot;atom/text&quot;
 
+require 'atom/feed'
+
 module Atom
+  # this is just a forward declaration since atom/entry includes atom/feed and vice-versa.
+  class Feed &lt; Atom::Element # :nodoc:
+  end
+
+  class Source &lt; Atom::Feed
+    is_atom_element :source
+
+    # TODO: this shouldn't be necessary, but on_init doesn't get inherited the
+    # way I would like it to.
+    @on_init = Atom::Feed.instance_variable_get '@on_init'
+  end
+
   class Control &lt; Atom::Element
     attr_accessor :draft
 
@@ -21,45 +35,6 @@ module Atom
     end
   end
 
-  module HasCategories
-    def HasCategories.included(klass)
-      klass.atom_elements :category, :categories, Atom::Category
-    end
-
-    # categorize the entry with each of an array or a space-separated
-    #   string
-    def tag_with(tags, delimiter = ' ')
-      return if not tags or tags.empty?
-
-      tag_list = unless tags.is_a?(String)
-                   tags
-                 else
-                   tags = tags.split(delimiter)
-                   tags.map! { |t| t.strip }
-                   tags.reject! { |t| t.empty? }
-                   tags.uniq
-                 end
-
-      tag_list.each do |tag|
-        unless categories.any? { |c| c.term == tag }
-          categories.new :term =&gt; tag
-        end
-      end
-    end
-  end
-
-  module HasLinks
-    def HasLinks.included(klass)
-      klass.atom_elements :link, :links, Atom::Link
-    end
-
-    def find_link(criteria)
-      self.links.find do |l|
-        criteria.all? { |k,v| l.send(k) == v }
-      end
-    end
-  end
-
   # An individual entry in a feed. As an Atom::Element, it can be
   # manipulated using accessors for each of its child elements. You
   # should be able to set them using an instance of any class that
@@ -94,7 +69,7 @@ module Atom
 
     atom_element :rights, Atom::Rights
 
-    # element :source, Atom::Feed  # XXX complicated, eg. serialization
+    atom_element :source, Atom::Source
 
     atom_time :published
     atom_time :updated</diff>
      <filename>lib/atom/entry.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,10 @@ require &quot;atom/entry&quot;
 require &quot;atom/http&quot;
 
 module Atom
+  # this is just a forward declaration since atom/entry includes atom/feed and vice-versa.
+  class Entry &lt; Atom::Element # :nodoc:
+  end
+
   class FeedGone &lt; RuntimeError # :nodoc:
   end
 </diff>
      <filename>lib/atom/feed.rb</filename>
    </modified>
    <modified>
      <diff>@@ -103,6 +103,19 @@ describe Atom::Entry do
       @entry.categories.first['term'].should == 'ann'
       @entry.categories.first['scheme'].should == 'http://example.org/cats'
     end
+
+    it 'should parse source element correctly' do
+      @entry.source.title.to_s.should == 'Atom Sample Feed'
+      @entry.source.id.should == 'tag:example.org,2003:/'
+
+      @entry.source.links.length.should == 1
+      @entry.source.links.first.rel == 'self'
+
+      @entry.source.authors.length.should == 0
+
+      @entry.source.contributors.length.should == 1
+      @entry.source.contributors.first.name == 'Mark Pilgrim'
+    end
   end
 
   describe 'title element' do</diff>
      <filename>spec/entry_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,14 @@
     href=&quot;http://example.org/2005/04/02/atom&quot;/&gt;
   &lt;link rel=&quot;enclosure&quot; type=&quot;audio/mpeg&quot; length=&quot;1337&quot;
     href=&quot;http://example.org/audio/ph34r_my_podcast.mp3&quot;/&gt;
+  &lt;source&gt;
+    &lt;title&gt;Atom Sample Feed&lt;/title&gt;
+    &lt;id&gt;tag:example.org,2003:/&lt;/id&gt;
+    &lt;link rel=&quot;self&quot; href=&quot;http://example.org/feed&quot;/&gt;
+    &lt;contributor&gt;
+      &lt;name&gt;Mark Pilgrim&lt;/name&gt;
+    &lt;/contributor&gt;
+  &lt;/source&gt;
   &lt;rights&gt;Copyright (c) 2003, Mark Pilgrim&lt;/rights&gt;
   &lt;id&gt;tag:example.org,2003:3.2397&lt;/id&gt;
   &lt;updated&gt;2005-07-31T12:29:29Z&lt;/updated&gt;</diff>
      <filename>spec/fixtures/entry.xml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>89389fb9f1d3174f76d3801f68c9295051e8aec9</id>
    </parent>
  </parents>
  <author>
    <name>Brendan Taylor</name>
    <email>whateley@gmail.com</email>
  </author>
  <url>http://github.com/bct/atom-tools/commit/9141d4ff51a5ebc4aab1743cf3f62d8f3a54067c</url>
  <id>9141d4ff51a5ebc4aab1743cf3f62d8f3a54067c</id>
  <committed-date>2009-08-15T14:25:13-07:00</committed-date>
  <authored-date>2009-08-15T14:25:13-07:00</authored-date>
  <message>basic atom:source support (finally!)</message>
  <tree>c57ee270619ae9efdaa7a31deff1dc6676d9706d</tree>
  <committer>
    <name>Brendan Taylor</name>
    <email>whateley@gmail.com</email>
  </committer>
</commit>
