inkling
2007-Feb-07 22:15 UTC
Would calling 3.am or 1130.pm be a useful way of getting a Time object?
Would "am" and "pm" be convenient and useful methods that Rails should stick on top of the Numeric class? So instead of calling Time.parse("23:30") to get a Time object at 11:30 PM, you could do 1130.pm instead. Just trying to get an opinion before I create a patch, unit tests, etc and try and convince someone to notice :) Here are the methods if anyone wants to use them: http://code.inklingmarkets.com/journal/2007/2/7/an-easy-way-to-have-a-time-in-ruby.html --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeremy McAnally
2007-Feb-07 23:17 UTC
Re: Would calling 3.am or 1130.pm be a useful way of getting a Time object?
That''s actually pretty cool! I''ve never even thought of that. I''d probably use it a few times, especially when doing scheduling of things. It would make it easier to think about at least. :) --Jeremy On 2/7/07, inkling <nate-UgwZ4owrJFB8UrSeD/g0lQ@public.gmane.org> wrote:> > Would "am" and "pm" be convenient and useful methods that Rails should > stick on top of the Numeric class? > > So instead of calling Time.parse("23:30") to get a Time object at > 11:30 PM, you could do 1130.pm instead. > > Just trying to get an opinion before I create a patch, unit tests, etc > and try and convince someone to notice :) > > Here are the methods if anyone wants to use them: > > http://code.inklingmarkets.com/journal/2007/2/7/an-easy-way-to-have-a-time-in-ruby.html > > > > >-- http://www.jeremymcanally.com/ My free Ruby e-book: http://www.humblelittlerubybook.com/book/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Andrew Stone
2007-Feb-08 00:58 UTC
Re: Would calling 3.am or 1130.pm be a useful way of getting a Time object?
On 2/7/07, inkling <nate-UgwZ4owrJFB8UrSeD/g0lQ@public.gmane.org> wrote:> > > Would "am" and "pm" be convenient and useful methods that Rails should > stick on top of the Numeric class? > > So instead of calling Time.parse("23:30") to get a Time object at > 11:30 PM, you could do 1130.pm instead. > > Just trying to get an opinion before I create a patch, unit tests, etc > and try and convince someone to notice :) > >I think it''s a very useful idea. It follows the same concepts already in place with dates. Consider it noticed. :) -- Andrew Stone --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---