<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>workbench @ haefelinger.it &#187; devel</title>
	<atom:link href="http://workbench.haefelinger.it/archives/category/devel/feed" rel="self" type="application/rss+xml" />
	<link>http://workbench.haefelinger.it</link>
	<description>Notes, thouhts and other stuff on software development</description>
	<lastBuildDate>Wed, 07 Apr 2010 07:02:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IRB and the missing idiom</title>
		<link>http://workbench.haefelinger.it/archives/19</link>
		<comments>http://workbench.haefelinger.it/archives/19#comments</comments>
		<pubDate>Thu, 24 Sep 2009 11:04:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[devel]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://workbench.haefelinger.it/?p=19</guid>
		<description><![CDATA[I have recently turned my eye on using Ruby for small and not so small programms. Honestly, Ruby is really exciting and should probably also been listed as one of those things that brings the wow! back on your computer (the other being Apple and Google). Then there&#8217;s this book about Ruby, the so called [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently turned my eye on using Ruby for small and not so small programms. Honestly, Ruby is really exciting and should probably also been listed as one of those things that brings the <em>wow!</em> back on your computer (the other being Apple and Google). Then there&#8217;s this book about Ruby, the so called <a href="http://www.pragprog.com/titles/ruby/programming-ruby">Pick-Axe</a>, wetting my appetite.</p>
<p>The Pick-Axe writes also about <code>irb</code>, the interactive ruby interpreter. So what you can do with <code>irb</code> is to fire it up and hack away some ruby code to give it a try. When you eventually shutdown <code>irb</code> your typed code is gone of course. The book shows lots of such examples. </p>
<p>That&#8217;s all fine and good except that using irb this way is bit unrealistic. Actually what I really want to do is to load my ruby project in irb and call methods, create objects, inspect variables etc &#8212; without running my project of course. But this is exactly what happens when doing something like</p>
<pre lang="bash">
% irb -r 'foobar.rb'
</pre>
<p>So how to tell irb not to execute my ruby code? Unfortunatly the Pick-Axe is rather silent on this. Here&#8217;s how to do it:</p>
<pre lang="ruby">
if __FILE__ == $0
  # executed if not in irb
  ..
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://workbench.haefelinger.it/archives/19/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
