Ruby/Date/downto
Материал из Wiki.crossplatform.ru
Версия от 18:00, 13 сентября 2010; ViGOur (Обсуждение | вклад)
With Date"s downto method, count down five days, displaying each date as you go (this makes in-place changes to the date)
require "date" date = Date.new( 2006, 11, 8 ) date.downto( date - 5 ) { |date| puts date } # date has changed date.to_s # => "2007-11-03"