Ron Lusk on 17 Dec 2005 22:30:09 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PhillyOnRails] Time formatting


I picked the ampersand ("&") out of the air because I figured it wasn't used anywhere else (except in XML/HTML, etc.) .  Use what isn't likely to interfere with other characters in your app.

As for using Ruby formatting ("#{foo}") instead of printf formatting ("%d" % foo), I think I was deliberately showing the freedom to format your own way.  The "Ruby" way would work, of course, for this example.

On 12/17/05, Brian Buckley < briankbuckley@gmail.com> wrote:
>> Wow

Wow indeed.  Are those codes  ('&m' and '&d') your picks or are they from C roots?

Nitpicking is this even more ruby-like?
 
def strftime(x )
    result = orig_strftime(x)
    result.gsub!(/&m/){ "#{month}" }
    result.gsub!(/&d/){ "#{day}" }
    result
end

Brian Buckley

--
Ron Lusk
ronlusk@alum.mit.edu
_______________________________________________
talk mailing list
talk@phillyonrails.org
http://lists.phillyonrails.org/mailman/listinfo/talk