Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
7 lines (6 sloc) 949 Bytes
---
timestamp: 2006-03-08 17:01:07
title: brain breaks
tags: ruby
id: 39
content: "<p>What will this code produce?</p> <pre class=\"code\"><span class=\"keyword\">class </span>Confusion<br /> <span class=\"keyword\">def</span> <span class=\"keyword\">self</span>.confuse<br /> &nbsp; &nbsp; never_defined = <span class=\"literal\">'defined'</span> <span class=\"keyword\">if</span> <span class=\"keyword\">false</span><br /> &nbsp; &nbsp; never_defined<br /> <span class=\"keyword\">end</span><br /> <br /> <span class=\"keyword\">def</span> method_missing(m, *args)<br /> &nbsp; &nbsp; <span class=\"literal\">'Will you see this?'</span><br /> <span class=\"keyword\">end</span><br /> <span class=\"keyword\">end</span><br /> <br /> puts Confusion.confuse</pre> <p><b>Update: </b> KirinDave has <a href='http://blog.caboo.se/articles/2006/03/08/your-ruby-gotcha-of-the-day#comments'>a more informative explanation</a> on the caboose blog.</p> "