From: Trans Date: 2007-07-28T22:26:42+09:00 Subject: Re: Facets error while using Time.parse On Jul 28, 5:38 am, Daniel DeLorme wrote: > Trans wrote: > >> [spatel@taamserver ~]$ cat x1.rb > >> require 'facets' > >> p Time.parse("3:40:40") > >> p Time.parse('4:41:41') > >> p Time.parse('5:42:42') > >> [spatel@taamserver ~]$ ruby x1.rb > >> Fri Jul 27 03:40:40 -0500 2007 > >> Fri Jul 27 13:24:55 -0500 2007 > >> Fri Jul 27 13:24:55 -0500 2007 > > > Want to see the culprit? Would you believe I tracked it to this: > > > class Symbol > > # Same functionality as before, just a touch more efficient. > > > def to_s > > @to_s || (@to_s = id2name) > > end > > end > > I can't reproduce it on my system but for this kind of stuff you should > use id2name.freeze, otherwise the value of @to_s might be modified. In > others words, it's *not* the same functionality. Indeed. I use to have #freeze in there, but apparently that caused it's own set of problems (or maybe it was the same problems in a different guise). T.