More solutions for the projecteuler.net problems. Some of them are solved using 1.9.2 features.
Become a Proc Star!
One useful (and funny) feature of Ruby is the Symbol#to_proc
method that lets you write concise code like this: %w|1 2 3 4|.map(&:to_i)
. Almost everyone who knows this feature loves it ;). However, the use cases are pretty limited, because in most cases you need to pass parameters!
New Array and Enumerable methods in Ruby 1.9.2: keep_if, chunk...
In Ruby, dealing with Arrays and similar objects is pretty fun. And we have gotten more possibilities with Ruby 1.9.2 :)
The 28 Bytes of Ruby Joy!
The 28 Bytes of Ruby Joy will notably clean up your code:
Just another "Ruby code is beautiful" presentation ;)
These the slides for my proseminary about the Ruby syntax. It is loosely based on an essay by Yukihiro Matsumoto which is published in the O’Reilly book Beautiful Code. It is released under a creative commons license.
Upgrading to Rails 3: Obstacles and helper scripts
Transferring an existing project to Rails 3 is not that hard, but it usually cannot be done in 5 minutes.