<?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>I On Rails &#187; Ruby</title>
	<atom:link href="http://ionrails.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://ionrails.com</link>
	<description>Keeping an &#039;I&#039; on RoR</description>
	<lastBuildDate>Sat, 14 Jan 2012 07:17:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Ruby vs Python</title>
		<link>http://ionrails.com/2011/01/25/ruby-vs-python/</link>
		<comments>http://ionrails.com/2011/01/25/ruby-vs-python/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 07:08:27 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[python vs ruby]]></category>
		<category><![CDATA[ruby vs python]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=683</guid>
		<description><![CDATA[Python vs. Ruby: A Battle to The Death]]></description>
			<content:encoded><![CDATA[<p><a href="http://vimeo.com/9471538">Python vs. Ruby: A Battle to The Death</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2011/01/25/ruby-vs-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hidden Gems of Ruby 1.9</title>
		<link>http://ionrails.com/2010/09/18/hidden-gems-of-ruby-1-9/</link>
		<comments>http://ionrails.com/2010/09/18/hidden-gems-of-ruby-1-9/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 01:06:04 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Aaron Patterson]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[Event Emitting]]></category>
		<category><![CDATA[Evented Parsing]]></category>
		<category><![CDATA[Fiddle]]></category>
		<category><![CDATA[how to figure out code coverage]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[ObjectSpace]]></category>
		<category><![CDATA[Psych]]></category>
		<category><![CDATA[ruby 1.9]]></category>
		<category><![CDATA[Streamed Emitting]]></category>
		<category><![CDATA[yaml]]></category>
		<category><![CDATA[yaml parser]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=561</guid>
		<description><![CDATA[At GoGaRuco (Golden Gate RubyConf) in San Francisco, CA today&#8230; Talk by Aaron Patterson minitest require &#8216;minitest/autorun&#8217; refute_equal (same as assert_not in TestUnit) inherit from MiniTest::Unit::TestCase Test Performance Run test with -verbose, you can see how long each test takes. minitest/spec (similar to rspec) &#8212;&#8212;&#8212; ObjectSpace ObjectSpace.each_object do &#124;obj&#124; p obj end count_object_size (to see [...]]]></description>
			<content:encoded><![CDATA[<p>At GoGaRuco (Golden Gate RubyConf) in San Francisco, CA today&#8230;</p>
<p>Talk by Aaron Patterson</p>
<p><strong>minitest</strong></p>
<p>require &#8216;minitest/autorun&#8217;</p>
<p>refute_equal (same as assert_not in TestUnit)</p>
<p>inherit from MiniTest::Unit::TestCase</p>
<p>Test Performance<br />
Run test with -verbose, you can see how long each test takes.</p>
<p>minitest/spec (similar to rspec)<br />
&#8212;&#8212;&#8212;</p>
<p>ObjectSpace</p>
<p>ObjectSpace.each_object do |obj|<br />
  p obj<br />
end</p>
<p>count_object_size (to see how much memory a particular object is taking in total</p>
<p>memsize_of (returns size in bytes)</p>
<p>count_nodes</p>
<p>count_tdata_objects (counts native objects)<br />
&#8212;&#8212;</p>
<p><strong>Fiddle</strong></p>
<p>A libffi wrapper that&#8217;s in Ruby 1.9</p>
<p>Fiddle allows your Ruby code to call native functions (Dynamic Libraries) and allocate closures. </p>
<p>ruby-ffi</p>
<p>&#8212;&#8212;</p>
<p><strong>Psych (YAML Parser)</strong></p>
<p>JSON is a subset of YAML. So Psych will load JSON.</p>
<p>Psych supports Evented Parsing (similar to SAX XML Parsers which call events when certain xml elements are seen)</p>
<p>Event Emitting (emit YAML)</p>
<p>Streamed Emitting (an easy way for Evented Emitting. It emits immediately. There&#8217;s no buffering)</p>
<p>Each calls to push method emits multiple documents. </p>
<p>Streaming JSON Emitter (Psych::JSON::Stream)</p>
<p>&#8212;-<br />
<strong>How to Figure Out Code Coverage in Ruby 1.9</strong></p>
<p><a href="http://github.com/colszowka/simplecov">SimpleCov</a></p>
<p> <a href="http://bit.ly/19coverage">Writing a Code Coverage Tool with Ruby 1.9</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2010/09/18/hidden-gems-of-ruby-1-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lightning Talks at GoGaRuco</title>
		<link>http://ionrails.com/2010/09/18/lightning-talks-at-gogaruco/</link>
		<comments>http://ionrails.com/2010/09/18/lightning-talks-at-gogaruco/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 23:08:13 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[debugging tools]]></category>
		<category><![CDATA[Fixture Builder]]></category>
		<category><![CDATA[gogaruco]]></category>
		<category><![CDATA[http caching]]></category>
		<category><![CDATA[PerfTools.rb]]></category>
		<category><![CDATA[profiler]]></category>
		<category><![CDATA[Rubinius]]></category>
		<category><![CDATA[yehuda katz]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=550</guid>
		<description><![CDATA[At GoGaRuco (Golden Gate RubyConf) today in San Francisco, CA The following is just some brief notes and may or may not make any sense. Talks went pretty quickly. Concurrency with Rubinius Ron Evans &#8211; TicketMaster (universal api) &#8211; allows migration of one system to another. (supports JIRA amongst other things) &#8212;&#8211; Fixture Builder by [...]]]></description>
			<content:encoded><![CDATA[<p>At GoGaRuco (Golden Gate RubyConf) today in San Francisco, CA</p>
<p>The following is just some brief notes and may or may not make any sense. Talks went pretty quickly.</p>
<p>Concurrency with Rubinius</p>
<p>Ron Evans  &#8211; TicketMaster (universal api) &#8211; allows migration of one system to another. (supports JIRA amongst other things)</p>
<p>&#8212;&#8211;<br />
Fixture Builder by Ryan Dy and David Stevenson</p>
<p>Biggest problem with fixture is that their unmaintainable. </p>
<p>You can use Factories but they are too slow for large sets of data.</p>
<p>fixture_builder &#8211; generates fixtures and you can tell it to rebuild your fixtures. Adding fixture_builder at the beginning of your project is easier to do.</p>
<p>&#8212;&#8212;-</p>
<p>PerfTools.rb &#8211; Aman Gupta &#8211; Debugging Ruby</p>
<p>Debugging Tools:</p>
<p>PERFTOOLS &#8211; Google&#8217;s Performance Profiler<br />
pprof ruby ruby.prof &#8211;text</p>
<p>rack perftools profiler<br />
http://scrb.bi/debuggerruby (url is broken&#8230; will try to update once i have it)<br />
&#8212;&#8212;&#8212;&#8211;</p>
<p>Smart Browsers</p>
<p>HTML 5<br />
jolicloud<br />
Target smart browsers but gracefully degrade</p>
<p>Chrome Frame<br />
You can run Ruby in your browser through Native Client</p>
<p>&#8212;&#8211;</p>
<p>Terminator &#8211; Automating Your Workflow</p>
<p>Automates the setup of your dev env for each project<br />
<a href="http://www.padrinorb.com">Padrino Framework</a></p>
<p>gem install terminator</p>
<p>&#8212;-</p>
<p>What is <a href="http://jashkenas.github.com/coffee-script/">CoffeeScript</a>?</p>
<p>It&#8217;s a wrapper language for JavaScript. The code is Ruby-Like.</p>
<p>&#8212;-</p>
<p><a href="http://explainruby.net">Explain Ruby</a> allows you to paste Ruby code or a URL and then explains what your code does! It&#8217;s awesome for beginning Ruby developers especially and is awesome!!!</p>
<p>&#8212;&#8211;</p>
<p>HTTP Caching &#8211; Yehuda Katz</p>
<p>Grab out the If-Modified-Since headers from headers to get the last_modified time. If there isn&#8217;t a last_modified header, make up one and set it the post_modified.httpdate.  Set status to 304 when&#8230; Can someone fill in my missing details? Feel free to comment please :)</p>
<p>&#8212;-</p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2010/09/18/lightning-talks-at-gogaruco/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data-Driven Government and the Ruby Developer</title>
		<link>http://ionrails.com/2010/09/17/data-driven-government-ruby/</link>
		<comments>http://ionrails.com/2010/09/17/data-driven-government-ruby/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 19:37:15 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Data]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[california data]]></category>
		<category><![CDATA[chicago data]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[data sf]]></category>
		<category><![CDATA[government]]></category>
		<category><![CDATA[new york data]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[sunlight labs]]></category>
		<category><![CDATA[united states data]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=531</guid>
		<description><![CDATA[At GoGaRuCo (Golden Gate RubyConf) today in San Francisco, CA&#8230; Talk by Eric Mill who works at Sunlight Labs and who is working with government to make their data public. Here are some examples of where you can get data. Data SF.org Californa Data Chicago Every Block New York Data Mine United States Data GovTrack.us [...]]]></description>
			<content:encoded><![CDATA[<p>At GoGaRuCo (Golden Gate RubyConf) today in San Francisco, CA&#8230;</p>
<p>Talk by Eric Mill who works at Sunlight Labs and who is working with government to make their data public. Here are some examples of where you can get data.</p>
<p><a href="http://www.datasf.org">Data SF.org</a><br />
<a href="http://www.data.ca.gov">Californa Data</a><br />
<a href="http://www.chicagoeveryblock.com">Chicago Every Block</a><br />
<a href="http://www.nyc.gov/data">New York Data Mine</a><br />
<a href="http://www.data.gov">United States Data</a><br />
<a href="http://www.govtrack.us">GovTrack.us</a><br />
<a href="http://www.federalregister.gov">Federal Register</a> (launched a few months ago and &#8220;is amazing&#8221;)</p>
<p><a href="http://www.govpulse.us/">GovPulse</a> is the winner of the contest Sunlight Labs had recently. It&#8217;s a Ruby On Rails app running on Amazon EC2. It&#8217;s an open source app.</p>
<p>Government is beginning to serve developers and seeing them as one of their customers. Developers are beginning to give back to government.</p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2010/09/17/data-driven-government-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby APIs for NoSQL</title>
		<link>http://ionrails.com/2010/09/17/ruby-apis-for-nosql/</link>
		<comments>http://ionrails.com/2010/09/17/ruby-apis-for-nosql/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 18:53:46 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=529</guid>
		<description><![CDATA[At GoGaRuco (Golden Gate RubyConf) today in San Francisco, CA… Talk by: Sarah Mei, Pivotal Labs How you store data in Ruby without using a relational database. ActiveModel compliant libraries mongoDB: mongoid &#8211; gem: mongoid How do you unify a model with a data scattered across multiple stores? This is not solved yet. How do [...]]]></description>
			<content:encoded><![CDATA[<p>At GoGaRuco (Golden Gate RubyConf) today in San Francisco, CA…</p>
<p>Talk by: Sarah Mei, Pivotal Labs</p>
<p>How you store data in Ruby without using a relational database.</p>
<p>ActiveModel compliant libraries </p>
<p>mongoDB:<br />
mongoid &#8211; gem: mongoid</p>
<p>How do you unify a model with a data scattered across multiple stores? This is not solved yet.</p>
<p>How do you replace the primary store? Solved in Rails 3. </p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2010/09/17/ruby-apis-for-nosql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Succeeding at Open Source Development</title>
		<link>http://ionrails.com/2010/09/17/succeeding-at-open-source-development/</link>
		<comments>http://ionrails.com/2010/09/17/succeeding-at-open-source-development/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 17:23:46 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Processes]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[gogaruco]]></category>
		<category><![CDATA[golden gate rubyconf]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[processes]]></category>
		<category><![CDATA[ruby open source]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=516</guid>
		<description><![CDATA[At GoGaRuco (Golden Gate RubyConf) today&#8230; Here&#8217;s what I got out of the Open Source Development talk: If you want to build up your open source project and manage it properly, you have to be open to newer contributors who are enthusiastic, even if they build a feature you think is useless. Communication is important. [...]]]></description>
			<content:encoded><![CDATA[<p>At GoGaRuco (Golden Gate RubyConf) today&#8230;</p>
<p>Here&#8217;s what I got out of the Open Source Development talk:</p>
<p>If you want to build up your open source project and manage it properly, you have to be open to newer contributors who are enthusiastic, even if they build a feature you think is useless. Communication is important.</p>
<p>Avoid complicated workflow/processes. Premature process is the root of all frustration. Use as little process as you can. Add a process as you need to.</p>
<p>Have contributors achieve the easiest wins first. Simple goals and easy tasks are important. Tell them to &#8220;run this command and fix what is broken.&#8221; Get them in the door by giving them simple tasks first. Tell contributors to get the spec working first, for example. </p>
<p>&#8220;Have no core team&#8221; since giving trust to your contributors is important. </p>
<p>Conclusion:</p>
<p>Be open, give trust, communicate well and don&#8217;t take it personally.</p>
<p>Open Source Development is a social contract. Contributors want to succeed. They want to help with your project but they also want respect.</p>
<p>FAQ:</p>
<p>Communication tools you recommend? </p>
<p>* irc is not great but it&#8217;s better than anything else.<br />
* Get on the phone with a contributor.<br />
* Video chat<br />
* Screen share with audio<br />
* use whatever tool to avoid latency. </p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2010/09/17/succeeding-at-open-source-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RVM and Frozen Rails Conflict</title>
		<link>http://ionrails.com/2010/03/12/rvm-frozen-rails-conflict/</link>
		<comments>http://ionrails.com/2010/03/12/rvm-frozen-rails-conflict/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 21:29:48 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Installing]]></category>
		<category><![CDATA[Rails Versioning]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[bundler]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[managing gems]]></category>
		<category><![CDATA[rails version]]></category>
		<category><![CDATA[rails versions]]></category>
		<category><![CDATA[ruby version]]></category>
		<category><![CDATA[ruby versions]]></category>
		<category><![CDATA[rvm]]></category>
		<category><![CDATA[rvm and frozen rails]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=361</guid>
		<description><![CDATA[I have an existing rails application and want to switch to using RVM in order to tie particular versions of Ruby, Rails and RubyGems to this application. My existing Rails application has a frozen Rails version 2.2.2 tied into it and so exists in my vendor/rails directory. Before I installed RVM, the following question came [...]]]></description>
			<content:encoded><![CDATA[<p>I have an existing rails application and want to switch to using RVM in order to tie particular versions of Ruby, Rails and RubyGems to this application. My existing Rails application has a frozen Rails version 2.2.2 tied into it and so exists in my vendor/rails directory.</p>
<p>Before I installed RVM, the following question came into my mind:<br />
How do you take an existing Rails app and determine which gems and versions it uses?<br />
I don&#8217;t know the answer yet but do have one solution as described below.</p>
<p>I&#8217;d like to use the Bundler gem but really need to know which gems to specify in the Gemfile, which sits in the root of my rails application directory. So, my goal here is to use RVM to reconstruct the list of gems by adding one gem at a time into my application and troubleshoot. Eventually, I&#8217;ll come up with a list of gems my app requires and assuming I&#8217;m successful, I can use that list to construct the Gemfile for Bundler.</p>
<p>Initially when you install RVM, you start with a clean slate, meaning your gem list won&#8217;t show any installed gems for a particular ruby version you&#8217;ve installed into your .rvm directory via the rvm command. Prior to RVM you would have all of these gems installed but it was very difficult to know which gems exactly you used in your app. I&#8217;m hoping that I can not only tie a set of gems to a particular ruby version but I&#8217;d like to associate a particular ruby, rails and gem version to each particular application. I hope RVM will support this. Still playing around with it to find out. Feel free to comment below. Thanks!</p>
<h2 class="navid_content">Installing RVM and Reinstalling Ruby, Rails and RubyGems for RVM</h2>
<ol>
<li>Install RVM from GitHub Repository as indicated here http://rvm.beginrescueend.com/rvm/install/</li>
<li>rvm install 1.9.1; rvm 1.9.1 &#8211;default (&#8211;default makes it so 1.9.1 will be your default version, in other new shells you open up as well)</li>
<li>remember if you want to switch back to your system Ruby, Rails and RubyGems, just type: rvm system. To switch to 1.9.1, for example, again, just type rvm use 1.9.1</li>
<li>gem install rails (notice when you are installing gems under rvm, you should NOT type &#8216;sudo&#8217;)</li>
</ol>
<h2 class="navid_content">You may notice the following RVM and frozen rails conflict</h2>
<pre class="brush: ruby; title: ; notranslate">
navid@~/Development/yourapp: script/server
/Users/navid/Development/yourapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require': no such file to load -- test/unit/error (MissingSourceFile)
	from /Users/navid/Development/yourapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `block in require'
	from /Users/navid/Development/yourapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
	from /Users/navid/Development/yourapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
	from /Users/navid/Development/yourapp/vendor/rails/activesupport/lib/active_support/deprecation.rb:224:in `&lt;top (required)&gt;'
	from /Users/navid/Development/yourapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
	from /Users/navid/Development/yourapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `block in require'
	from /Users/navid/Development/yourapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
	from /Users/navid/Development/yourapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
	from /Users/navid/Development/yourapp/vendor/rails/activesupport/lib/active_support.rb:37:in `&lt;top (required)&gt;'
	from /Users/navid/Development/yourapp/vendor/rails/railties/lib/commands/server.rb:1:in `require'
	from /Users/navid/Development/yourapp/vendor/rails/railties/lib/commands/server.rb:1:in `&lt;top (required)&gt;'
	from script/server:3:in `require'
	from script/server:3:in `&lt;main&gt;'
</pre>
<h2 class="navid_content">Frozen Rails version tied to your application will conflict with RVM</h2>
<p>Solution: remove the frozen rails version from your application while in your system settings (i.e. while in your non RVM settings).</p>
<p>So, I did steps 1 through 4 above and then typed script/server in my rails application&#8217;s root directory and noticed conflicts because I had frozen rails 2.2.2 into my application earlier.  </p>
<p>So, the solution is to unfreeze rails from the application which basically deletes the /vendor/rails directory.</p>
<p>With RVM, I also am hoping that freezing the rails versions into an application is no longer needed and actually should not be done, or else you&#8217;ll run into this conflict.</p>
<p>However, keep in mind, you&#8217;ll probably run into a similar issue if you try to unfreeze rails while in you RVM environment, if RVM is conflicting with the frozen rails. </p>
<p>So the best thing to do is the following, revert back to your system settings, unfreeze rails and then come back to your rvm environment:</p>
<ol>
<li>rvm system</li>
<li>rake rails:unfreeze</li>
<li>rvm use default or rvm use 1.9.1</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2010/03/12/rvm-frozen-rails-conflict/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby File Path Separators</title>
		<link>http://ionrails.com/2010/02/01/ruby-file-path-separators/</link>
		<comments>http://ionrails.com/2010/02/01/ruby-file-path-separators/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 01:33:30 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[file path separators]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=350</guid>
		<description><![CDATA[File path separators on Unix systems and Windows are different. On Unix, a forward slash / is used and on Windows a backslash \ is used. However, when writing Ruby code you don&#8217;t need to worry about this; Just use the forward slash / character and it will be cross-platform for you. An even better [...]]]></description>
			<content:encoded><![CDATA[<p>File path separators on Unix systems and Windows are different. On Unix, a forward slash / is used and on Windows a backslash \ is used. </p>
<p>However, when writing Ruby code you don&#8217;t need to worry about this; Just use the forward slash / character and it will be cross-platform for you.</p>
<p>An even better option is to use File.join to join a paths together. The correct file path separator for the particular platform will be used. See <a href="http://ruby-doc.org/core/classes/File.html#M002545">File.join</a></p>
<p>When using the File.join method for absolute paths, the first argument to the join method must be an empty string.</p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2010/02/01/ruby-file-path-separators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instance and Class Variable Accessor Methods</title>
		<link>http://ionrails.com/2010/02/01/instance-and-class-variable-accessor-methods/</link>
		<comments>http://ionrails.com/2010/02/01/instance-and-class-variable-accessor-methods/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 06:42:58 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[methods]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[accessor methods]]></category>
		<category><![CDATA[attribute methods]]></category>
		<category><![CDATA[reader methods]]></category>
		<category><![CDATA[writer methods]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=340</guid>
		<description><![CDATA[When you define classes in Ruby, you must specify what kind of access you want to give Instance and Class attributes/variables which are defined in that class. The way you do it is that you write reader and writer methods. You can write these methods out explicitly or use the shorthand attribute (attr_) methods like [...]]]></description>
			<content:encoded><![CDATA[<p>When you define classes in Ruby, you must specify what kind of access you want to give Instance and Class attributes/variables which are defined in that class.</p>
<p>The way you do it is that you write reader and writer methods. You can write these methods out explicitly or use the shorthand attribute (attr_) methods like attr_reader, attr_writer and attr_accessor. These are methods defined in core Ruby. </p>
<p>However, in Ruby, there is no equivalent attr methods to read and write Class variables, at least none that I know of. Luckily, they are defined in Rails though and are called cattr_reader, cattr_writer and cattr_accessor. Be sure to test it out using script/console. You won&#8217;t be able to try it out in irb since irb uses Ruby not the Rails libraries.</p>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2010/02/01/instance-and-class-variable-accessor-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby Iterators</title>
		<link>http://ionrails.com/2010/01/30/ruby-iterators/</link>
		<comments>http://ionrails.com/2010/01/30/ruby-iterators/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 06:31:04 +0000</pubDate>
		<dc:creator>navid</dc:creator>
				<category><![CDATA[methods]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[Blocks]]></category>
		<category><![CDATA[downto]]></category>
		<category><![CDATA[each]]></category>
		<category><![CDATA[each_line]]></category>
		<category><![CDATA[iterator]]></category>
		<category><![CDATA[iterators]]></category>
		<category><![CDATA[range]]></category>
		<category><![CDATA[step]]></category>
		<category><![CDATA[upto]]></category>

		<guid isPermaLink="false">http://ionrails.com/?p=334</guid>
		<description><![CDATA[Here are some Ruby Iterators and description of how they can be used: times Iterate through the block 3 times, n starts at 0 and ends at 2 and is incremented by 1 each time. n is the block variable. upto Iterate through the block 3 times, starting at 1 and ending at 3, each [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some Ruby Iterators and description of how they can be used:</p>
<h2 class="navid_content">times</h2>
<p>Iterate through the block 3 times, n starts at 0 and ends at 2 and is incremented by 1 each time.<br />
n is the block variable.</p>
<pre class="brush: ruby; title: ; notranslate">
3.times do |n|
  puts n
end
</pre>
<h2 class="navid_content">upto</h2>
<p>Iterate through the block 3 times, starting at 1 and ending at 3, each time incrementing by 1.<br />
n is the block variable.</p>
<pre class="brush: ruby; title: ; notranslate">
1.upto(3) do |n|
  puts n
end
</pre>
<h2 class="navid_content">downto</h2>
<p>Iterate through the block 3 times, starting at 3 and ending at 1, each time decrementing by 1.<br />
n is the block variable.</p>
<pre class="brush: ruby; title: ; notranslate">
3.downto(1) do |n|
  puts n
end
</pre>
<h2 class="navid_content">Ranges and the <em>each</em> iterator</h2>
<p>Iterate through the block 3 times by specifying a Range starting at 1 and ending at 3, each time incrementing by 1. A Range (1..3) is specified and is actually an object of type &#8216;Range&#8217;.</p>
<pre class="brush: ruby; title: ; notranslate">
(1..3).each do |n|
  puts n
end
</pre>
<h2 class="navid_content">step</h2>
<p>Iterate through the block a range of 2 through 10 times, starting at 2 and ending at 10, each time incrementing by the step specified (2 in this case). A Range (2..10) is specified and is actually an object of type &#8216;Range&#8217;.<br />
n is the block variable.</p>
<pre class="brush: ruby; title: ; notranslate">
(2..10).step(2) do |n|
  puts n
end
</pre>
<h2 class="navid_content">each_line</h2>
<p>Iterate through the block however number of newlines there are in the String specified. The each_line iterator can be used with Strings only since Strings have newlines and it doesn&#8217;t make sense for other objects to have newlines.<br />
line is the block variable.</p>
<pre class="brush: ruby; title: ; notranslate">
&quot;hello\nworld\nhow\nare\nyou?&quot;.each_line do |line|
puts line
end
</pre>
<h2 class="navid_content">each_byte</h2>
<p>Iterate through the block however number of characters there are in the String specified. The byte form of the character is passed into the block as a parameter one_byte and is converted to its character equivalent before being printed to the screen.<br />
one_byte is the block variable.</p>
<pre class="brush: ruby; title: ; notranslate">
&quot;hello world&quot;.each_byte do |one_byte|
printf &quot;%c\n&quot;, one_byte
end
</pre>
<h2 class="navid_content">each_index</h2>
<p>Iterate through the block however number of elements there are in the array, passing the index of the elements to the block as an argument i. By contrast, the <em>each</em> iterator would have passed in the value of each element itself rather than the index.<br />
i is the block variable.</p>
<pre class="brush: ruby; title: ; notranslate">
[1, 4, 5, 7, 10, 12].each_index do |i|
  puts i
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ionrails.com/2010/01/30/ruby-iterators/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

