<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Extending _why&#8217;s Creature class</title>
	<atom:link href="http://drnicwilliams.com/2006/08/28/extending-_whys-creature-class/feed/" rel="self" type="application/rss+xml" />
	<link>http://drnicwilliams.com/2006/08/28/extending-_whys-creature-class/</link>
	<description>Ruby makes Rails, Javascript makes Ajax, Dr Nic makes Magic</description>
	<pubDate>Sun, 20 Jul 2008 08:51:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Mark McGranaghan &#187; Blog Archive &#187; Bookmarks: August 4th through August 5th</title>
		<link>http://drnicwilliams.com/2006/08/28/extending-_whys-creature-class/#comment-40849</link>
		<dc:creator>Mark McGranaghan &#187; Blog Archive &#187; Bookmarks: August 4th through August 5th</dc:creator>
		<pubDate>Mon, 06 Aug 2007 00:44:49 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2006/08/28/extending-_whys-creature-class/#comment-40849</guid>
		<description>[...] Even ruby has problems, or, How to hack optional parameters for blocks [...]</description>
		<content:encoded><![CDATA[<p>[...] Even ruby has problems, or, How to hack optional parameters for blocks [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr Nic</title>
		<link>http://drnicwilliams.com/2006/08/28/extending-_whys-creature-class/#comment-223</link>
		<dc:creator>Dr Nic</dc:creator>
		<pubDate>Mon, 28 Aug 2006 23:42:46 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2006/08/28/extending-_whys-creature-class/#comment-223</guid>
		<description>Bad formatting! I'll add the example to the body where formatting is respected.

I'm glad blocks can take splatted arguments. I don't think I knew they could til now. Cool.</description>
		<content:encoded><![CDATA[<p>Bad formatting! I&#8217;ll add the example to the body where formatting is respected.</p>
<p>I&#8217;m glad blocks can take splatted arguments. I don&#8217;t think I knew they could til now. Cool.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://drnicwilliams.com/2006/08/28/extending-_whys-creature-class/#comment-222</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 28 Aug 2006 21:57:32 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2006/08/28/extending-_whys-creature-class/#comment-222</guid>
		<description>Hey, formatting.</description>
		<content:encoded><![CDATA[<p>Hey, formatting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://drnicwilliams.com/2006/08/28/extending-_whys-creature-class/#comment-221</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 28 Aug 2006 21:56:11 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2006/08/28/extending-_whys-creature-class/#comment-221</guid>
		<description>Hi Dr Nic.  Nice write up.  Just wanted to mention that it's possible, but some would argue less clean, to do optional parameters with a define_method block.  Splat the block, yeah.

  def self.traits( *arr )
    arr.each do &#124;a&#124;
      metaclass.instance_eval do
        define_method( a ) do &#124;*val&#124;
          val = val.first
          @traits &#124;&#124;= {}
          return @traits[a] if not val
          @traits[a] = val
        end
      end
    end</description>
		<content:encoded><![CDATA[<p>Hi Dr Nic.  Nice write up.  Just wanted to mention that it&#8217;s possible, but some would argue less clean, to do optional parameters with a define_method block.  Splat the block, yeah.</p>
<p>  def self.traits( *arr )<br />
    arr.each do |a|<br />
      metaclass.instance_eval do<br />
        define_method( a ) do |*val|<br />
          val = val.first<br />
          @traits ||= {}<br />
          return @traits[a] if not val<br />
          @traits[a] = val<br />
        end<br />
      end<br />
    end</p>
]]></content:encoded>
	</item>
</channel>
</rss>
