What is the best way to convert a Ruby string range to a Range object,
I have some Ruby code which takes dates on the command line in the format:
I want to run for all dates between
20080229 inclusive and the other dates present in the list.
I can get the string
20080201..20080229, so is the best way to convert this to a Range instance? Currently, I am using
eval, but it feels like there should be a better way.
@Purfideas I was kind of looking for a more general answer for converting any string of type
int..int to a Range I guess.
That’s the answer What is the best way to convert a Ruby string range to a Range object, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.
The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you