<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Rubyize this</title>
	<atom:link href="http://www.rubyfleebie.com/rubyize-this/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rubyfleebie.com/rubyize-this/</link>
	<description>Because programming should be fun</description>
	<lastBuildDate>Thu, 15 Jul 2010 19:48:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: solid debit casinos on pc</title>
		<link>http://www.rubyfleebie.com/rubyize-this/comment-page-1/#comment-813</link>
		<dc:creator>solid debit casinos on pc</dc:creator>
		<pubDate>Fri, 30 Jan 2009 02:57:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this/#comment-813</guid>
		<description>&lt;strong&gt;solid debit casinos on pc...&lt;/strong&gt;

copse converges:beanbag toughly:bushwhacked ...</description>
		<content:encoded><![CDATA[<p><strong>solid debit casinos on pc&#8230;</strong></p>
<p>copse converges:beanbag toughly:bushwhacked &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: www mybetcasino com</title>
		<link>http://www.rubyfleebie.com/rubyize-this/comment-page-1/#comment-812</link>
		<dc:creator>www mybetcasino com</dc:creator>
		<pubDate>Mon, 26 Jan 2009 10:05:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this/#comment-812</guid>
		<description>&lt;strong&gt;www mybetcasino com...&lt;/strong&gt;

journalizes Harley wedge rankness ...</description>
		<content:encoded><![CDATA[<p><strong>www mybetcasino com&#8230;</strong></p>
<p>journalizes Harley wedge rankness &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Jones</title>
		<link>http://www.rubyfleebie.com/rubyize-this/comment-page-1/#comment-283</link>
		<dc:creator>Matt Jones</dc:creator>
		<pubDate>Thu, 28 Jun 2007 02:10:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this/#comment-283</guid>
		<description>A little late, but this is an interesting approach:


def manage_ducks(ducks)
  throw(nil) unless ducks.won_stanley_cup? rescue ducks = fetch_some_champions  
  ducks.beat_random_opponent
end


A little weird, but it works. If ducks is nil, the unless clause will throw an exception; if 
won_stanley_cup? is false, it throws a nil exception.</description>
		<content:encoded><![CDATA[<p>A little late, but this is an interesting approach:</p>
<p>def manage_ducks(ducks)<br />
  throw(nil) unless ducks.won_stanley_cup? rescue ducks = fetch_some_champions<br />
  ducks.beat_random_opponent<br />
end</p>
<p>A little weird, but it works. If ducks is nil, the unless clause will throw an exception; if<br />
won_stanley_cup? is false, it throws a nil exception.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RSL</title>
		<link>http://www.rubyfleebie.com/rubyize-this/comment-page-1/#comment-282</link>
		<dc:creator>RSL</dc:creator>
		<pubDate>Tue, 26 Jun 2007 03:24:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this/#comment-282</guid>
		<description>Woops. You&#039;re right. I did have that backwards. I guess I shouldn&#039;t post comments [especially not ones containing _code_] before I&#039;ve finished my morning coffee.</description>
		<content:encoded><![CDATA[<p>Woops. You&#8217;re right. I did have that backwards. I guess I shouldn&#8217;t post comments [especially not ones containing _code_] before I&#8217;ve finished my morning coffee.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nando Vieira</title>
		<link>http://www.rubyfleebie.com/rubyize-this/comment-page-1/#comment-281</link>
		<dc:creator>Nando Vieira</dc:creator>
		<pubDate>Mon, 25 Jun 2007 23:14:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this/#comment-281</guid>
		<description>Sorry... my bad! ;)
I posted it without reviewing just to be fast.. huahahuahuau. :P</description>
		<content:encoded><![CDATA[<p>Sorry&#8230; my bad! ;)<br />
I posted it without reviewing just to be fast.. huahahuahuau. :P</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.rubyfleebie.com/rubyize-this/comment-page-1/#comment-280</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Mon, 25 Jun 2007 22:33:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this/#comment-280</guid>
		<description>Thanks everyone for commenting in this first edition of Rubyize this (seeing it was quite popular there will be some more).

My favorite solution is without a doubt the one by Nando (once you remove the logic mistake like Silvio has pointed out) and Casey. In this situation I prefer the if over unless because it feels more natural. (unless ducks and ducks.won_stanley_cup? can be a bit confusing when you read it).

I&#039;d also like to talk about RSL suggestions which I find very interesting (the second one is a bit cryptic... but still pretty nice). Although the first solution looks awkward at first, I find it extremely readable and clean. I&#039;ll try to include some of this stuff in my applications in the future.

RSL, however I don&#039;t understand your last comment. &quot;if ducks.nil?&quot; is definitely not the same as &quot;if ducks&quot;. I guess you wanted to say &quot;unless ducks&quot;.</description>
		<content:encoded><![CDATA[<p>Thanks everyone for commenting in this first edition of Rubyize this (seeing it was quite popular there will be some more).</p>
<p>My favorite solution is without a doubt the one by Nando (once you remove the logic mistake like Silvio has pointed out) and Casey. In this situation I prefer the if over unless because it feels more natural. (unless ducks and ducks.won_stanley_cup? can be a bit confusing when you read it).</p>
<p>I&#8217;d also like to talk about RSL suggestions which I find very interesting (the second one is a bit cryptic&#8230; but still pretty nice). Although the first solution looks awkward at first, I find it extremely readable and clean. I&#8217;ll try to include some of this stuff in my applications in the future.</p>
<p>RSL, however I don&#8217;t understand your last comment. &#8220;if ducks.nil?&#8221; is definitely not the same as &#8220;if ducks&#8221;. I guess you wanted to say &#8220;unless ducks&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RSL</title>
		<link>http://www.rubyfleebie.com/rubyize-this/comment-page-1/#comment-279</link>
		<dc:creator>RSL</dc:creator>
		<pubDate>Mon, 25 Jun 2007 15:20:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this/#comment-279</guid>
		<description>Also, you don&#039;t have to ask &quot;if ducks.nil?&quot; when &quot;if ducks&quot; works just fine and is perfectly idiomatic Ruby.</description>
		<content:encoded><![CDATA[<p>Also, you don&#8217;t have to ask &#8220;if ducks.nil?&#8221; when &#8220;if ducks&#8221; works just fine and is perfectly idiomatic Ruby.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RSL</title>
		<link>http://www.rubyfleebie.com/rubyize-this/comment-page-1/#comment-278</link>
		<dc:creator>RSL</dc:creator>
		<pubDate>Mon, 25 Jun 2007 15:18:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this/#comment-278</guid>
		<description>One thing I noticed no one was doing is taking advantage of Ruby returning an object from assignment. The whole ducks.beat_random_opponent thing can do without the ducks.

&lt;pre&gt;
# Verbose
def manage_ducks(ducks)
  unless ducks and ducks.won_stanley_cup?
    fetch_some_champions
  else
    ducks
  end.beat_random_opponent
end

# Superterse, if Perl-y
def manage_ducks(ducks)
  ((ducks &amp;&amp; ducks.won_stanley_cup?) ? ducks : fetch_some_champions).beat_random_opponent
end
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>One thing I noticed no one was doing is taking advantage of Ruby returning an object from assignment. The whole ducks.beat_random_opponent thing can do without the ducks.</p>
<pre>
# Verbose
def manage_ducks(ducks)
  unless ducks and ducks.won_stanley_cup?
    fetch_some_champions
  else
    ducks
  end.beat_random_opponent
end

# Superterse, if Perl-y
def manage_ducks(ducks)
  ((ducks &amp;&amp; ducks.won_stanley_cup?) ? ducks : fetch_some_champions).beat_random_opponent
end
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Silvio Fonseca</title>
		<link>http://www.rubyfleebie.com/rubyize-this/comment-page-1/#comment-277</link>
		<dc:creator>Silvio Fonseca</dc:creator>
		<pubDate>Mon, 25 Jun 2007 13:06:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this/#comment-277</guid>
		<description>Nando and Alpha Chen solutions were exactly what I had in mind. IMHO, Nando&#039;s solutions is a bit better, using the &quot;nil?&quot; method, which is easier to understand. Just a minor correction on the logic:

&lt;pre&gt;def manage_ducks(ducks)
  ducks = ducks.fetch_some_champions &lt;b&gt;if&lt;/b&gt; ducks.nil? &#124;&#124; !ducks.won_stanley_cup?
  ducks.beat_random_opponent
end&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Nando and Alpha Chen solutions were exactly what I had in mind. IMHO, Nando&#8217;s solutions is a bit better, using the &#8220;nil?&#8221; method, which is easier to understand. Just a minor correction on the logic:</p>
<pre>def manage_ducks(ducks)
  ducks = ducks.fetch_some_champions <b>if</b> ducks.nil? || !ducks.won_stanley_cup?
  ducks.beat_random_opponent
end</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Casey Winans</title>
		<link>http://www.rubyfleebie.com/rubyize-this/comment-page-1/#comment-276</link>
		<dc:creator>Casey Winans</dc:creator>
		<pubDate>Mon, 25 Jun 2007 12:52:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/rubyize-this/#comment-276</guid>
		<description>&lt;pre&gt;def manage_ducks(ducks)
  ducks = fetch_some_champions if ducks.nil? &#124;&#124; !ducks.won_stanley_cup?
  ducks.beat_random_opponent
end&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<pre>def manage_ducks(ducks)
  ducks = fetch_some_champions if ducks.nil? || !ducks.won_stanley_cup?
  ducks.beat_random_opponent
end</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
