From: Kent Sibilev Date: 2005-04-29T12:09:08+09:00 Subject: Re: Days in month Someting like that: require 'date' require 'enumerator' class Date def days_in_month self.class.civil(year, month, -1).day end alias dim days_in_month def weekdays (1..dim).to_a end def cal_print banner = ABBR_DAYNAMES.map{|d| d[0..1]}.join(' ') puts "#{MONTHNAMES[month]} #{year}".center(banner.size) puts banner wd = [' '] * wday + weekdays wd.each_slice(7) do |slice| puts slice.map{|d| d.to_s.rjust(2)}.join(' ') end end end month = (ARGV[0] || Date.today.mon).to_i year = (ARGV[1] || Date.today.year).to_i Date.civil(year, month).cal_print Kent. On 4/28/05, "Pe�a, Botp" wrote: > Ara.T.Howard@noaa.gov [mailto:Ara.T.Howard@noaa.gov] wrote: > > # harp:~ > cal 2 2005 > # February 2005 > # Su Mo Tu We Th Fr Sa > # 1 2 3 4 5 > # 6 7 8 9 10 11 12 > # 13 14 15 16 17 18 19 > # 20 21 22 23 24 25 26 > # 27 28 > # > # harp:~ > cal 12 2005 > # December 2005 > # Su Mo Tu We Th Fr Sa > # 1 2 3 > # 4 5 6 7 8 9 10 > # 11 12 13 14 15 16 17 > # 18 19 20 21 22 23 24 > # 25 26 27 28 29 30 31 > # > #boy i love ruby. > > i took a deep breath there. > I thought you were going to show us your cal.rb :-) > > A ruby quiz perhaps? > > kind regards -botp > > # > #cheers. > # > #-a > #-- > >