From: Justin Collins Date: 2006-10-24T10:44:18+09:00 Subject: Re: [SPAM] Override Time#to_s -- how? Ben Winekur wrote: > Hey everyone, > > I'd like to override the Time#to_s function to parse Time objects a > specific way -- how can I do this from within my script? (Without > modifying the Time class itself) > > Thanks, > Ben > > You mean output time objects a certain way? Here's one: class Time def to_s puts "Hi Time!" end end Then: Time.now.to_s => "Hi!" I'm not sure if that counts as modifying the Time class or not. You kind of have to do that to override the function, don't you? -Justin