It's easy to transfer the string "year, month, day" to the parameter
format that meets the requirement of Date.new(year, month, day) :

date_start = @start.split(',').map {|x|, x.to_i}
date_stop = @stop.split(',').map {|x|, x.to_i}
days = (Date.new(@start)..Date.new(@stop)).to_a

Still elegant?

On 1/24/06, misiek <michaelaugustyniak / gazeta.pl> wrote:
> Sky Yin wrote:
> > Range can help you. Example:
> >
> >
> >>>require 'date'
> >>>days = (Date.new(2006,1,20)..Date.new(2006,1,24)).to_a
> >>>days.each {|date| puts date}
> >
> > =>2006-01-20
> > =>2006-01-21
> > =>2006-01-22
> > =>2006-01-23
> > =>2006-01-24
> >
> > :^)
> >
>
> this is super but why when I will put 2006,3,2 into variable
> like @start = "2006,1,3" and @stop = "2006,1,4" does not work ?
> days = (Date.new(@start)..Date.new(@stop)).to_a
>
>
> undefined method `-' for "2006,1,3":String
>
>


--
Blog >>> http://spaces.msn.com/members/skyincookoo