Le 28 juin ? 06:17, Pe?a, Botp a ?crit :

> solution: a) convert elements to some common class (string is common)
>           b) filter those you don't want sorted (using compact/reject/..)
>              or select those you want (using select/map/..)

c) Use a sort(_by) block (maybe that's what you meant in a) :

>> ["a", nil, "b"].sort_by { |e| (e.nil? ? 'z' : e) }
=> ["a", "b", nil]

> A little digression for everyone though...
>   irb(main):013:0> [nil].sort
>   => [nil]
>
> is that intended?

Well, you don't need the comparison operator where there's only one
element, do you ?

Fred
-- 
There is no god up in the sky tonight      No sign of heaven anywhere in
sight  All that was true is left behind  Once I could see now I am blind
Don't want the dreams you try to sell      This disease I give to myself
                                                 (Nine Inch Nails, Suck)