<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>MIT-LICENSE</filename>
    </added>
    <added>
      <filename>Rakefile</filename>
    </added>
    <added>
      <filename>init.rb</filename>
    </added>
    <added>
      <filename>install.rb</filename>
    </added>
    <added>
      <filename>lib/sexy_actions.rb</filename>
    </added>
    <added>
      <filename>tasks/sexy_actions_tasks.rake</filename>
    </added>
    <added>
      <filename>test/sexy_actions_test.rb</filename>
    </added>
    <added>
      <filename>uninstall.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -0,0 +1,114 @@
+SexyActions
+===========
+
+No more ugly &quot;respond_to&quot; format.
+
+
+Requirements
+============
+
+* Rails 2.x or higher
+
+
+Example
+=======
+
+* before
+
+  class UserController &lt; ApplicationController
+    def show
+      @user = User.find(params[:id])
+
+      respond_to do |type|
+        type.html
+        type.xml  { render :text =&gt; @user.to_xml }
+        type.js   { render :action =&gt; &quot;index.rjs&quot; }
+      end
+    end
+
+* after
+
+  class UserController &lt; ApplicationController
+    include SexyActions
+
+    show {
+      @user = User.find(params[:id])
+    }
+
+    show.xml {
+      render :text =&gt; @user.to_xml
+    }
+
+    show.js {
+      render :action =&gt; &quot;index.rjs&quot;
+    }
+
+
+Mechanism
+=========
+
+    show {
+      @user = User.find(params[:id])
+    }
+
+1. Accessing to unknown &quot;show&quot; method with block invokes UserController.method_missing
+2. It defines &quot;show&quot; instance method with given block
+
+    show.xml {
+      render :text =&gt; @user.to_xml
+    }
+
+3. Accessing to unknown &quot;show&quot; method without block returns a SexyActions::Responder instance object
+4. &quot;.xml&quot; defines UserController#render_{action}_for_{mime_type} method by SexyActions::Responder#method_missing
+
+   http://localhost:3000/user/show/1.xml
+
+5. UserController#show action is called as usal
+6. UserController#default_render kicks UserController#render_show_for_xml for mime rendering
+
+
+Console Coding
+==============
+
+  % ./script/console
+
+  # list action is not defined yet
+  &gt;&gt; UserController.new.respond_to?(:list)
+  =&gt; false
+
+  # accesing without block causes normal error
+  &gt;&gt; UserController.list
+  NoMethodError: undefined method `list' for UserController:Class
+          from /home/maiha/sexy_actions/vendor/plugins/sexy_actions/lib/sexy_actions.rb:70:in `method_missing'
+          from (irb):1
+
+  # accessing with block means defining action
+  &gt;&gt; UserController.list { @users = User.find(:all) }
+  =&gt; proc {@users = User.find(:all)}
+
+  # list action was just defined
+  &gt;&gt; UserController.new.respond_to?(:list)
+  =&gt; true
+
+  # once defined, accessing without block returns a proxy object
+  &gt;&gt; UserController.list
+  =&gt; #&lt;SexyActions::Responder:0xb728af34 @owner=UserController, @action=&quot;list&quot;, @order=[]&gt;
+
+  # the proxy object accepts mime rendering logic
+  &gt;&gt; UserController.list.xml { render :text=&gt;@users.to_xml }
+  =&gt; UserController
+
+  # getting mime rendering method name
+  &gt;&gt; UserController.list.render_method_for(:xml)
+  =&gt; &quot;render_list_for_xml&quot;
+
+  # mime rendering method is defined as private
+  &gt;&gt; UserController.new.respond_to? &quot;render_list_for_xml&quot;
+  =&gt; false
+  &gt;&gt; UserController.new.respond_to? &quot;render_list_for_xml&quot;, true
+  =&gt; true
+
+
+
+Copyright (c) 2008 [maiha@wota.jp], released under the MIT license
+</diff>
      <filename>README</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>414abee311deb1b88549295ffee2a0ef753b8058</id>
    </parent>
  </parents>
  <author>
    <name>maiha</name>
    <email>maiha@wota.jp</email>
  </author>
  <url>http://github.com/maiha/sexy_actions/commit/f9b232db2f111619c210694511f9d4231da64b6a</url>
  <id>f9b232db2f111619c210694511f9d4231da64b6a</id>
  <committed-date>2008-07-28T14:46:05-07:00</committed-date>
  <authored-date>2008-07-28T14:46:05-07:00</authored-date>
  <message>initial</message>
  <tree>4341c8acb84625e5c3f323d8871a609f1d1f3b5b</tree>
  <committer>
    <name>maiha</name>
    <email>maiha@wota.jp</email>
  </committer>
</commit>
