Humorous Moment

2006-10-20

I use the Money gem quite a bit in my Rails applications. One thing I needed was to often add or substract one penny from an amount. So, I did like all good programmers should do:

lib/money_extensions.rb

1 class Money
2 Penny = Money.new(1).freeze
3 end

Turns out that when using the constant, it ends up looking like this:


1 amount -= Money::Penny

I never knew I’d have a Bond Girl in my Rails code :)

Search

Your Host

A picture of me

I am François Beausoleil, a Ruby on Rails and Scala developer. During the day, I work on Seevibes, a platform to measure social interactions related to TV shows. At night, I am interested many things. Read my biography.

Top Tags

Books I read and recommend

Links

Projects I work on

Projects I worked on