From: Jason Roelofs Date: 2008-01-06T00:15:07+09:00 Subject: Re: Fixnums can have instance variables? Cool. ------=_Part_903_23014231.1199546112874 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Welcome to Monkey Patching! This is how ActiveResource gives you things like: 4.days.ago "some string".underscore and the like. It's one of the many things that makes Ruby code very fun to write. Jason On Jan 5, 2008 10:07 AM, Barca Junior wrote: > > > > > class Fixnum > > attr_accessor :note > > end > > > > 13.note = "a baker's dozen" > > 25.note = "5 squared" > > > > notes = [13, 21, 25].collect { |x| x.note } # ["a baker's dozen", > > nil, "5 squared"] > > > > > It's really cool. > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_903_23014231.1199546112874--