<?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: Quiz</title>
	<atom:link href="http://hobocentral.net/blog/2007/08/25/quiz/feed/" rel="self" type="application/rss+xml" />
	<link>http://hobocentral.net/blog/2007/08/25/quiz/</link>
	<description>Hobo - the web app builder for Rails</description>
	<lastBuildDate>Wed, 03 Mar 2010 11:41:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Try() as you might &#124; Lambda @ Copa</title>
		<link>http://hobocentral.net/blog/2007/08/25/quiz/comment-page-1/#comment-51577</link>
		<dc:creator>Try() as you might &#124; Lambda @ Copa</dc:creator>
		<pubDate>Sun, 11 Jan 2009 12:43:18 +0000</pubDate>
		<guid isPermaLink="false">http://hobocentral.net/blog/2007/08/25/quiz/#comment-51577</guid>
		<description>&lt;p&gt;[...] I came across a few other alternatives that were entertaining the idea of using method_missing, but let&#039;s [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] I came across a few other alternatives that were entertaining the idea of using method_missing, but let&#8217;s [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Feng : Learning from io</title>
		<link>http://hobocentral.net/blog/2007/08/25/quiz/comment-page-1/#comment-48522</link>
		<dc:creator>Aaron Feng : Learning from io</dc:creator>
		<pubDate>Thu, 25 Sep 2008 03:18:13 +0000</pubDate>
		<guid isPermaLink="false">http://hobocentral.net/blog/2007/08/25/quiz/#comment-48522</guid>
		<description>&lt;p&gt;[...] The above code is taken from this post The post didn&#039;t mention io, but I assumed it is inspired by it. In ruby you can&#039;t just use the &quot;?&quot; for your method name, therefore, _ is prepended before &quot;?&quot;.Now you can do following without checking the parent object: offer.&lt;em&gt;?.price.&lt;/em&gt;?.formatted_amount [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] The above code is taken from this post The post didn&#8217;t mention io, but I assumed it is inspired by it. In ruby you can&#8217;t just use the &#8220;?&#8221; for your method name, therefore, _ is prepended before &#8220;?&#8221;.Now you can do following without checking the parent object: offer.<em>?.price.</em>?.formatted_amount [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: trapdoor1 &#187; Object.too_clever_by_half? rescue nil</title>
		<link>http://hobocentral.net/blog/2007/08/25/quiz/comment-page-1/#comment-30751</link>
		<dc:creator>trapdoor1 &#187; Object.too_clever_by_half? rescue nil</dc:creator>
		<pubDate>Sat, 05 Apr 2008 13:07:38 +0000</pubDate>
		<guid isPermaLink="false">http://hobocentral.net/blog/2007/08/25/quiz/#comment-30751</guid>
		<description>&lt;p&gt;[...] Monkey-patching proposals have abounded in the Ruby community recently - including, but not limited to Object#andand, Object#&lt;em&gt;? and SafeNil and Object#method&lt;/em&gt;. [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Monkey-patching proposals have abounded in the Ruby community recently &#8211; including, but not limited to Object#andand, Object#<em>? and SafeNil and Object#method</em>. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tyler Rick</title>
		<link>http://hobocentral.net/blog/2007/08/25/quiz/comment-page-1/#comment-12453</link>
		<dc:creator>Tyler Rick</dc:creator>
		<pubDate>Fri, 12 Oct 2007 11:08:08 +0000</pubDate>
		<guid isPermaLink="false">http://hobocentral.net/blog/2007/08/25/quiz/#comment-12453</guid>
		<description>&lt;p&gt;This is awesome! I&#039;ve been wanting something like this for ages.&lt;/p&gt;

&lt;p&gt;I hope you don&#039;t mind, I&#039;ve added it to the quality_extensions gem on RubyForge. (&lt;a href=&quot;http://quality-ext.rubyforge.org/rdoc/classes/NilClass.html&quot; rel=&quot;nofollow&quot;&gt;rdoc&lt;/a&gt; &lt;a href=&quot;http://quality-ext.rubyforge.org/src/lib/quality_extensions/safe_nil.rb&quot; rel=&quot;nofollow&quot;&gt;source&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Hopefully we can get this included in Facets too so an even wider group of people can enjoy it!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This is awesome! I&#8217;ve been wanting something like this for ages.</p>
<p>I hope you don&#8217;t mind, I&#8217;ve added it to the quality_extensions gem on RubyForge. (<a href="http://quality-ext.rubyforge.org/rdoc/classes/NilClass.html" rel="nofollow">rdoc</a> <a href="http://quality-ext.rubyforge.org/src/lib/quality_extensions/safe_nil.rb" rel="nofollow">source</a>)</p>
<p>Hopefully we can get this included in Facets too so an even wider group of people can enjoy it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://hobocentral.net/blog/2007/08/25/quiz/comment-page-1/#comment-11842</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Tue, 02 Oct 2007 18:10:12 +0000</pubDate>
		<guid isPermaLink="false">http://hobocentral.net/blog/2007/08/25/quiz/#comment-11842</guid>
		<description>&lt;p&gt;Coda -- all of your examples have one thing in commen that this operator was specifically intended to avoid. &lt;code&gt;string_or_nil&lt;/code&gt; occurs twice.&lt;/p&gt;

&lt;p&gt;The places where I use _? are where I don&#039;t have the value in a local variable, and I don&#039;t want to assign it to one just because I have an operation to perform &quot;only if the value is not nil&quot;. e.g.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;if Foo.expensive_method_call._?.closed?
  ...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I see this pattern all the time in my code and I really enjoy not having to make the code more verbose. To me this reads like a spec, once you&#039;ve internalised the simple _? operator.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Coda &#8212; all of your examples have one thing in commen that this operator was specifically intended to avoid. <code>string_or_nil</code> occurs twice.</p>
<p>The places where I use _? are where I don&#8217;t have the value in a local variable, and I don&#8217;t want to assign it to one just because I have an operation to perform &#8220;only if the value is not nil&#8221;. e.g.</p>
<pre><code>if Foo.expensive_method_call._?.closed?
  ...
</code></pre>
<p>I see this pattern all the time in my code and I really enjoy not having to make the code more verbose. To me this reads like a spec, once you&#8217;ve internalised the simple _? operator.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Coda Hale</title>
		<link>http://hobocentral.net/blog/2007/08/25/quiz/comment-page-1/#comment-11840</link>
		<dc:creator>Coda Hale</dc:creator>
		<pubDate>Tue, 02 Oct 2007 17:45:02 +0000</pubDate>
		<guid isPermaLink="false">http://hobocentral.net/blog/2007/08/25/quiz/#comment-11840</guid>
		<description>&lt;p&gt;Why not just use single-line conditionals?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;x = string_or_nil.length unless string_or_nil.nil?
x #=&gt; nil
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Or, if you&#039;re looking for compound conditions:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;if (not string_or_nil.nil?) &amp;&amp; (string_or_nil.length == 4)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This seems like a fair bit of cleverness to avoid making your guard conditions explicit -- which seems to me like it could make maintenance more of a pain than it already is.&lt;/p&gt;

&lt;p&gt;Also, unlike the ternary operator, this doesn&#039;t allow you to specify a fallback value without using &lt;code&gt;&#124;&#124;&lt;/code&gt; or some other comparison. Why not this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;x = (string_or_nil &amp;&amp; string_or_nil.length) &#124;&#124; 6
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Other than that, cool Ruby trick.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Why not just use single-line conditionals?</p>
<pre><code>x = string_or_nil.length unless string_or_nil.nil?
x #=&gt; nil
</code></pre>
<p>Or, if you&#8217;re looking for compound conditions:</p>
<pre><code>if (not string_or_nil.nil?) &amp;&amp; (string_or_nil.length == 4)
</code></pre>
<p>This seems like a fair bit of cleverness to avoid making your guard conditions explicit &#8212; which seems to me like it could make maintenance more of a pain than it already is.</p>
<p>Also, unlike the ternary operator, this doesn&#8217;t allow you to specify a fallback value without using <code>||</code> or some other comparison. Why not this:</p>
<pre><code>x = (string_or_nil &amp;&amp; string_or_nil.length) || 6
</code></pre>
<p>Other than that, cool Ruby trick.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Ternary Destroyer &#171; coderrr</title>
		<link>http://hobocentral.net/blog/2007/08/25/quiz/comment-page-1/#comment-10639</link>
		<dc:creator>The Ternary Destroyer &#171; coderrr</dc:creator>
		<pubDate>Sat, 15 Sep 2007 18:30:45 +0000</pubDate>
		<guid isPermaLink="false">http://hobocentral.net/blog/2007/08/25/quiz/#comment-10639</guid>
		<description>&lt;p&gt;[...] The Ternary&#160;Destroyer Filed under: Uncategorized &#8212; coderrr @ 6:59 pm   I just ran across this Hobo blog post which describes an awesome way to get rid of a lot of use cases for the ternary operator. [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] The Ternary&nbsp;Destroyer Filed under: Uncategorized &#8212; coderrr @ 6:59 pm   I just ran across this Hobo blog post which describes an awesome way to get rid of a lot of use cases for the ternary operator. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve d</title>
		<link>http://hobocentral.net/blog/2007/08/25/quiz/comment-page-1/#comment-10638</link>
		<dc:creator>steve d</dc:creator>
		<pubDate>Sat, 15 Sep 2007 18:26:28 +0000</pubDate>
		<guid isPermaLink="false">http://hobocentral.net/blog/2007/08/25/quiz/#comment-10638</guid>
		<description>&lt;p&gt;2000% speed increase if you define SafeNil this way:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;class SafeNil
  def method_missing(method, *args, &amp;b)
    return nil  unless nil.respond_to? method
    nil.send(method, *args, &amp;b) rescue nil
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Only problem with this way would be if you define method&lt;em&gt;missing on nil to route method calls to it, because then respond&lt;/em&gt;to? wouldn&#039;t be accurate&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>2000% speed increase if you define SafeNil this way:</p>
<pre><code>class SafeNil
  def method_missing(method, *args, &amp;b)
    return nil  unless nil.respond_to? method
    nil.send(method, *args, &amp;b) rescue nil
  end
end
</code></pre>
<p>Only problem with this way would be if you define method<em>missing on nil to route method calls to it, because then respond</em>to? wouldn&#8217;t be accurate</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve d</title>
		<link>http://hobocentral.net/blog/2007/08/25/quiz/comment-page-1/#comment-10637</link>
		<dc:creator>steve d</dc:creator>
		<pubDate>Sat, 15 Sep 2007 17:26:02 +0000</pubDate>
		<guid isPermaLink="false">http://hobocentral.net/blog/2007/08/25/quiz/#comment-10637</guid>
		<description>&lt;p&gt;Awesome!  very useful!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Awesome!  very useful!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Allen</title>
		<link>http://hobocentral.net/blog/2007/08/25/quiz/comment-page-1/#comment-10388</link>
		<dc:creator>Ryan Allen</dc:creator>
		<pubDate>Mon, 10 Sep 2007 01:13:45 +0000</pubDate>
		<guid isPermaLink="false">http://hobocentral.net/blog/2007/08/25/quiz/#comment-10388</guid>
		<description>&lt;p&gt;Good in loose views for missing methods? I dunno. SafeNil makes me nervous...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Good in loose views for missing methods? I dunno. SafeNil makes me nervous&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
