First, what I have:
s = "1,3..5,8"
What I want:
["1", "3", "4", "5", "8"]
I found a way with as below
r = s.split(/\s?,\s?/)
=> ["10", "12..15", "17", "
r.map do |c|
if Fixnum === eval(c)
c
else
eval(c).map(&:to_s).flatten
end
end
=> ["10", "12", "13", "14", "15", "17", "18"]
Would there be a better way to achieve this?