<p>I have some Ruby code which takes dates on the command line in the format:</p>

<pre><code>-d 20080101,20080201..20080229,20080301
</code></pre>

<p>I want to run for all dates between <code>20080201</code> and <code>20080229</code> inclusive and the other dates present in the list.</p>

<p>I can get the string <code>20080201..20080229</code>, so is the best way to convert this to a Range instance? Currently, I am using <code>eval</code>, but it feels like there should be a better way.</p>

<hr>

<p>@Purfideas I was kind of looking for a more general answer for converting any string of type <code>int..int</code> to a Range I guess.</p>

assuming you want the range to iterate properly through months etc, try
```
```
require 'date'

ends = '20080201..20080229'.split('..').map{|d| Date.parse(d)}
(ends[0]..ends[1]).each do |d|
  p d.day
end
```
```