From: ara.t.howard@... Date: 2006-10-27T02:34:56+09:00 Subject: Re: Creating a Schedule-like array On Fri, 27 Oct 2006, anthony.green@bbc.co.uk wrote: >> Another way to compute timeslots which avoids this might be: >> >> timeslots = (0..6*24).map {|h| first + h.hour} >> >> Generalizing this to arbitray start and end times is left as an >> exercise to the reader. > > Maybe this ? so you represent day segments > > start_time = Time.gm(2006, 10, 31, 0, 0, 0) > slots = 3 > no_of_days = 3 > > schedule =[] > timeslots = (0..slots).map{|h| start_time + h.hour} > timeslots.each do |timeslot| > (0..no_of_days).map do |i| > schedule << timeslot+i.day > end > end > puts schedule > > Tony http://runt.rubyforge.org/ -a -- my religion is very simple. my religion is kindness. -- the dalai lama