From: "Brian Schröder" Date: 2005-04-29T07:14:06+09:00 Subject: Re: Newbie question: Simple Ruby Date Question On 28/04/05, mattscape wrote: > Thanks ! > I guess I like Ryans version better. > Mostly because I understand it ;-) > > The version of Kazuhisa is not that hard to understand. First: (Date.new(month.year, month.month, 1)..Date.new(month.year, month.month, -1)) Is the range of days in the given month. (-1 is often used as index for the last item, the same applies e.g. to Array and String). Then he selects those elements from the range that have a weekday between 1 and 5, that are all the days you wanted. The result is an array of the weekdays of the month. You will see that this reads a lot simpler than my english description or your procedural code once you understood it. Or break it in two lines then it is nearly english days_of_the_month = (Date.new(month.year, month.month, 1)..Date.new(month.year, month.month, -1)) weekdays_of_month = days_of_the_month.select { | day | (1..5).include?day.wday } best regards, Brian -- http://ruby.brian-schroeder.de/ multilingual _non rails_ ruby based vocabulary trainer: http://www.vocabulaire.org/ | http://www.gloser.org/ | http://www.vokabeln.net/