A quick Ruby hack to steal some OS X goodness

A quick Ruby hack to steal some OS X goodness:

I really like the open command on OS X, but I was too lazy to look for its Linux equivalent.

Actually, my solution probably took less time than sifting through a google search:

system(case ARGV[0]
when /\.pdf/
“epdfview”
when /\.html/
“firefox”
when /\.(rb)|(pl)|(pm)/
“vim”
end + ” #{ARGV[0]}”)

Source: O’Reilly Ruby

Leave a comment