I have some Ruby code which takes dates on the command line in the format:
-d 20080101,20080201..20080229,20080301
I want to run for all da
Combining @Purfideas answer with another answer somewhere on StackOverflow, I solved this by also surrounding the code with an input check, so the only thing used is a valid enumerable
if !value[/^[0-9]+\.\.[0-9]+$/].nil?
ends = value.split('..').map{|d| Integer(d)}
value = ends[0]..ends[1]
end
It essentially rewrites your string value to a enumerable value. This comes in handy if you add a enumerable field in a yaml config file.
If you need it for your application, you could extend the regex with an optional third literal dot, that could be optional.