I would honestly prefer something less assumptive of the ordering of times, 
like Time.now.during?(:month => 2) That way you could just pass it "bits" of a 
time, rather than Time.now.during?(nil, 2), which is just ugly.

Other than that, I do like this idea. 
-- 
Ryan Bigg

On Tuesday, 15 March 2011 at 7:18 AM, Farski wrote: 
> 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.
> 

-- 
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.

Reply via email to