I have a array of foo objects, each of which contains an array bar
values. I’d like to sort the foos, ordered by the bars. The problem
is that the bars are of unequal length.
The most apt example is the numbering in an outline: 1, 1.1, 1.2,
1.2.1, 1.3 …etc.
In practical terms, comparing 1.1 to 1.2.1 would be [1, 1, nil] <=>
[1, 2, 1]. Array#sort_by barfs on the nil. Is there some nice way to
let nil always sort low?
Also having problems with a Regexp, but I can’t find the appropriate
forum to cry in.
Cheers,
Bob Schaaf