From: Mark Hubbart Date: 2005-05-11T05:38:22+09:00 Subject: Re: Enumerating only months in a Date range? On 5/10/05, John Lam wrote: > Thanks, Mark! > > The self >> 1 line is um, rather mysterious to me. How does that skip by months? That's the bitshift operator, which is often used in classes for other purposes. In the Date, it's used to add and subtract months: Date.today << 2 will give you 2 months ago today, while Date.today >> 1 will give you next month today. I guess they decided to use it for that because "+" and "-" were already taken, used for adding and subtracting days. Ranges use #succ (successor) to get the next object in a series. By redefining #succ to return self >> 1 (self + 1 month), we get a range of dates that skips by months rather than days. cheers, Mark