# File lib/vpim/date.rb, line 175 def DateGen.bywday(year, month, wday, n = nil) seed = Date.bywday(year, month, wday, n ? n : 1) dates = [ seed ] return dates if n succ = seed.clone # Collect all matches until we're out of the year (or month, if specified) loop do succ += 7 break if succ.year != year break if month && succ.month != seed.month dates.push succ end dates.sort! dates end