> How about this?
> 
> class Time
>     def begin_of_day
>        self - 3600 * hour - 60 * min - sec
>     end
> end
> 
> It passes your unit test.

ActiveSupport has a beginning_of_day method which is basically 
equivalent to that

This approach fails will fail if daylight saving changes in between 
midnight and the object on which you are calling begin_of_day. For 
example in the UK on the 29th of october midday is 13 hours after the 
previous midnight.

Fred


-- 
Posted via http://www.ruby-forum.com/.