From: Brian Neal Date: 2006-10-24T12:45:01+09:00 Subject: Re: 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 Perhaps you mean something like this? #!/usr/bin/env ruby t = Time.new #or populate from some variable in your script def t.to_s "Two minutes to midnight!" #your time parsing here end puts t.to_s puts Time.new_to_s Produces: Two minutes to midnight Mon Oct 23 23:42:49 -0400 2006 cheers, Brian -- Posted via http://www.ruby-forum.com/.