<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,8 @@
+= 0.3
+  - Fixed Model.textiled = false bug
+  - Refactored tests
+  - Changed api from @story.description_plain to @story.description(:plain) - kept old way, though
+
 = 0.2
 
   * Fix issue with object.attribute_plain overwriting the original attribute [Thanks, James]</diff>
      <filename>CHANGES</filename>
    </modified>
    <modified>
      <diff>@@ -21,10 +21,10 @@ You need RedCloth, of course.  And Rails.
   &gt;&gt; story.description
   =&gt; &quot;&lt;p&gt;This is &lt;strong&gt;cool&lt;/strong&gt;.&lt;/p&gt;&quot;
 
-  &gt;&gt; story.description_source
+  &gt;&gt; story.description(:source)
   =&gt; &quot;This is *cool*.&quot;
 
-  &gt;&gt; story.description_plain
+  &gt;&gt; story.description(:plain)
   =&gt; &quot;This is cool.&quot;
 
   &gt;&gt; story.description = &quot;I _know_!&quot;
@@ -90,7 +90,7 @@ You'll see the Textile plaintext in the text field.  It Just Works.
 If you're being a bit unconvential, no worries.  You can still get at your 
 raw Textile like so:
 
-  Description: &lt;br/&gt; &lt;%= text_field_tag :description, @story.description_source %&gt;
+  Description: &lt;br/&gt; &lt;%= text_field_tag :description, @story.description(:source) %&gt;
 
 And there's always object.textiled = false, as demo'd above.
 </diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -3,5 +3,5 @@ summary:
 homepage: http://errtheblog.com/post/14
 plugin: http://require.errtheblog.com/svn/acts_as_textiled
 license: MIT
-version: 0.1
+version: 0.3
 rails_version: 1.1+</diff>
      <filename>about.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,3 @@
+require 'RedCloth'
 require 'acts_as_textiled'
 ActiveRecord::Base.send(:include, Err::Acts::Textiled)</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,21 +6,35 @@ module Err
       end
 
       module ClassMethods
-        def acts_as_textiled(*attrs)
+        def acts_as_textiled(*attributes)
           @textiled_attributes = []
 
-          @textiled_unicode = &quot;&quot;.respond_to? :chars
+          @textiled_unicode = String.new.respond_to? :chars
 
-          ruled = Hash === attrs.last ? attrs.pop : {}
-          attrs += ruled.keys
+          ruled = attributes.last.is_a?(Hash) ? attributes.pop : {}
+          attributes += ruled.keys
 
-          attrs.each do |attr|
-            define_method(attr) do
-              textiled[attr.to_s] ||= RedCloth.new(self[attr], Array(ruled[attr])).to_html if self[attr]
+          type_options = %w( plain source )
+
+          attributes.each do |attribute|
+            define_method(attribute) do |*type|
+              type = type.first
+
+              if type.nil? &amp;&amp; self[attribute]
+                textiled[attribute.to_s] ||= RedCloth.new(self[attribute], Array(ruled[attribute])).to_html 
+              elsif type.nil? &amp;&amp; self[attribute].nil?
+                nil
+              elsif type_options.include?(type.to_s)
+                send(&quot;#{attribute}_#{type}&quot;)
+              else
+                raise &quot;I don't understand the `#{type}' option.  Try #{type_options.join(' or ')}.&quot;
+              end
             end
-            define_method(&quot;#{attr}_plain&quot;,  proc { strip_redcloth_html(__send__(attr)) if __send__(attr) } )
-            define_method(&quot;#{attr}_source&quot;, proc { __send__(&quot;#{attr}_before_type_cast&quot;) } )
-            @textiled_attributes &lt;&lt; attr
+
+            define_method(&quot;#{attribute}_plain&quot;,  proc { strip_redcloth_html(__send__(attribute)) if __send__(attribute) } )
+            define_method(&quot;#{attribute}_source&quot;, proc { __send__(&quot;#{attribute}_before_type_cast&quot;) } )
+
+            @textiled_attributes &lt;&lt; attribute
           end
 
           include Err::Acts::Textiled::InstanceMethods</diff>
      <filename>lib/acts_as_textiled.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,21 +17,27 @@ context &quot;An ActiveRecord instance acting as textiled&quot; do
     desc_plain   = '_why announces Sandbox'
 
     story.description.should.equal desc_html
-    #story.description(:source).should.equal desc_textile
-    #story.description(:plain).should.equal desc_plain
+    story.description(:source).should.equal desc_textile
+    story.description(:plain).should.equal desc_plain
 
     story.description_source.should.equal desc_textile
     story.description_plain.should.equal desc_plain
 
     # make sure we don't overwrite anything - thanks James
     story.description.should.equal desc_html
-    #story.description(:source).should.equal desc_textile
-    #story.description(:plain).should.equal desc_plain
+    story.description(:source).should.equal desc_textile
+    story.description(:plain).should.equal desc_plain
 
     story.description_source.should.equal desc_textile
     story.description_plain.should.equal desc_plain
   end
 
+  specify &quot;should raise when given a non-sensical option&quot; do
+    story = Story.find(1)
+
+    proc { story.description(:cassadaga) }.should.raise
+  end
+
   specify &quot;should pick up changes to attributes&quot; do
     story = Story.find(2)
     </diff>
      <filename>test/textiled_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d5fd7eebebede89cb9ffc152d6e08d2364df9bc0</id>
    </parent>
  </parents>
  <author>
    <name>Chris Wanstrath</name>
    <email>chris@ozmm.org</email>
  </author>
  <url>http://github.com/defunkt/acts_as_textiled/commit/eac71a20b391ee28623664658aaf17b26c4ce0cf</url>
  <id>eac71a20b391ee28623664658aaf17b26c4ce0cf</id>
  <committed-date>2007-06-03T04:35:21-07:00</committed-date>
  <authored-date>2007-06-03T04:35:21-07:00</authored-date>
  <message>add in acts_as_textiled api changes</message>
  <tree>2f2d61f415e787bdf1b81deafae1f5539462c2cf</tree>
  <committer>
    <name>Chris Wanstrath</name>
    <email>chris@ozmm.org</email>
  </committer>
</commit>
