About
Buy my book
Exceptional Ruby is the definitive guide to exceptions and failure handling in Ruby.
Pages
Categories
Monthly Archives: August 2010
ANN FireTower 0.0.4
For those of you using Campfire to communicate with your team, FireTower 0.0.4 is now out. New in this version is full Mac OSX support, courtesy of David T. Rogers. Install: gem install firetower Enjoy!
Posted in Uncategorized
3 Comments
Treating Arrays as Sets
Reading through the Rake source code the other day (a pastime I highly recommend), I was reminded of a technique I don’t use often enough: my_array = [:foo, :bar, :baz] my_array |= [:baz, :buz] # => [:foo, :bar, :baz, :buz] … Continue reading
Using Hashes as Caches
One of the coolest features of Ruby’s Hash class is that you can customize how it behaves when it can’t find a key. Stupid example: # Everybody knows that you can communicate with foreigners by # speaking loudly and slowly … Continue reading
“and” and “or” are like backwards statement modifiers
It occurred to me after reviewing all the feedback to my last post that despite making the connection to statement modifiers, I never directly contrasted the two. And that this might be an even simpler way of explaining the usefulness … Continue reading
Using “and” and “or” in Ruby
If you use Ruby long enough, you will discover the and and or operators. These appear at first glance to be synonyms for && and ||. You will then be tempted to use these English oprators in place of && … Continue reading
