On Oct 24, 2007, at 9:10 AM, Ken Bloom wrote: > On Wed, 24 Oct 2007 10:04:56 +0900, James Koppel wrote: > >> Here's my solution. It converts a time window into an array of >> arrays of >> ranges. Each range matches an interval of time (e.g.: 500..1700); >> each >> subarray contains all the ranges for a given day. I then wrote the >> simple Array#some method that returns true if the given predicate >> returns true for at least one of its elements, which I used to write >> TimeWindow#incude?. >> >> $days = {"Sun"=>0, >> "Mon"=>1, >> "Tue"=>2, >> "Wed"=>3, >> "Thu"=>4, >> "Fri"=>5, >> "Sat"=>6} > > I suggest using a constant rather than a global variable for this. You > can put the constant in the TimeWindow class. This is also just an Array disguised as a Hash. James Edward Gray II