The Time calculations were missing a nice, succinct way for testing if a time instance was during a specific period or range of times.
I came up with Time#during, which can take three forms of input: # a range of Times Time.now.during?(Time.now.midnight..Time.now.tomorrow.midnight) # a Date Time.now.during?(Date.today) # or number values, like Time.utc(2011, 3, 14) # which will create the smallest possible range with given arguments Time.now.during?(2011) Time.now.during?(2011, 3) Time.now.during?(2011, 3, 14) Time.now.during?(2011, 3, 14, 16) I think it's a very intuitive testing format, and fits in well with the rest of the Time calculations. Any thoughts? working branch: https://github.com/farski/rails/tree/time_calculations_during -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
