From: Justin Collins Date: 2006-10-24T10:46:19+09:00 Subject: Re: [SPAM] Override Time#to_s -- how? Justin Collins wrote: > 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 meant, Time.now.to_s => "Hi Time!" Obviously.