All posts written by Matthew O'Donnell

How the Ruby Interpreter Creates Methods on the Fly
(And why it matters!) I was lucky enough to attend last year's EuRuKo, the travelling European Ruby conference. A theme of the conference (for me) was Ruby's infamous embrace of metaprogramming, which I've had little exposure to in my day-to-day as a Rails dev. The approach to this discussion was inspired by this great talk by Masafumi Okura on Code Reading, and much of the detail comes from the book… Continue reading

Readable Dates in Rails
I was playing around in Swift recently, and wanted a reference to 'one day ago'. This is simple enough in human terms: if it's 9:30 on the 18th of September, 'one day ago' means 9:30 on the 17th of September. The Swift code to do this looks like this: Calendar.current.date( byAdding: .day, value: -1, to: Date.now ) ...and that's just a bit much, isn't it? First we need to access Calendar.current, a singleton… Continue reading