Inject the Hash before you tap it

There is a Ruby best practices blog that is exploring the uses of Object#tap, particularly with respect to building hashes, as per the example they give:


Written on Wed Aug 5 19:57:39 2009.
Tagged as ruby.

RSpec should each matcher

should each for easy testing of collections


Written on Wed Nov 5 20:31:20 2008.
Tagged as rspec, ruby, test.

Ruby blocks in Perl

The power of Ruby blocks is hidden in Perl. Create ruby rescue blocks in Perl


Written on Sun Oct 19 21:00:00 2008.
Tagged as perl, ruby.

Easy attribute assignment (in Rails)

Update: It seems like I reinvented Hash#slice which is already in the Rails API


Written on Fri Mar 21 17:34:39 2008.
Tagged as rails, ruby.

Navigating nil (Method Chaining) in Ruby

Method Chaining is an important technique to create beautiful code in object oriented languages, but Ruby (the beautiful language, right?) does not support it as well as it should.


Written on Sun Mar 16 08:17:59 2008.
Tagged as gem, ruby.

Real modules for Ruby

More specifically, Ruby doesn’t have real mixins (or interfaces or typeclasses if you like). But then what does a module mixin do? It modifies a class’s inheritance chain at runtime


Written on Tue Mar 11 16:26:54 2008.
Tagged as gem, ruby.

(A Detailed Explanation of) Ruby’s Symbol#to_proc

Must people love a new feature in Ruby called Symbol#to_proc, but there are not many good explanations of it. The concept is actually fairly straightforward, but the Ruby implementation is fairly complex. The following is an explanation that assumes no knowledge of Ruby.


Written on Mon Feb 25 18:04:26 2008.
Tagged as linux, ruby, script.

The script I use every day

The script I use most frequently is a script for extracting files. If you work from the linux command line, it is impossible to remember which program with which flags should be used to extract a file. This is something the computer should do for you! This extraction script solves the problem, and you can configure the first lines of the script to match any filetype. I use it so often that I have it aliased to ‘e’


Written on Fri Feb 1 00:59:26 2008.
Tagged as linux, ruby, script.

Too many choices! (in open source software)

Setting up my blog got me thinking: Do we really need so many blogging systems? To be specific, I am using an open source static blog generator. There are three different programs for this kind of blog written in the ruby programming language. Of course there are several open source dynamic ruby blogging systems. Venturing out of ruby, there are many blogging systems for all the other languages being used with web programming.


An Efficient Blogging Setup

I never thought I would be a blogger. It seemed so narcissitic to me, but I have come across a lot of useful information or cool ideas on people’s blogs. With that in mind, this blog will have a technical orientation since I know that nobody cares that I took a trip to the zoo yesterday. To prove it, here is the technical setup of my blog.