Bug #1317: Creating a range with strings
http://redmine.ruby-lang.org/issues/show/1317

Author: Ian Bailey
Status: Open, Priority: Normal
ruby -v: ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]

irb(main):027:0> Range.new("1", "10").to_a
=> ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
irb(main):028:0> Range.new("2", "10").to_a
=> []

The second result happens when the end of the range is greater numerically but the first character of the start is higher than the first character of the end.

It seems like these two return values are inconsistent. If the range is able to work a list of entries between two integers as strings, it should do it regardless of their first character.


----------------------------------------
http://redmine.ruby-lang.org