YANAGAWA Kazuhisa
4/28/2005 1:13:00 PM
In Message-Id: <1114639618.103794.222300@o13g2000cwo.googlegroups.com>
"mattscape" <matthias.luebken@gmail.com> writes:
> What would be a nice ruby way to write this?
Rather functional than rubyish though....
(Date.new(month.year, month.month, 1)..Date.new(month.year, month.month, -1)).select {|d| (1..5).include?(d.wday)}
is sufficient?
Date has instance method succ, so can generate Range, then we can use
Enumerable#select for filtering elements in the Range.
--
kjana@dm4lab.to April 28, 2005
Translators, traitors.