I'm trying to turn a string into an array sorted first by descending length, then by descending alphabetical order among strings of similar length. That is, "x ya yz z" should return ["yz", "ya", "z", "x"]. I see that an analogous question was posed in python. What would the ruby way be?
I understand the string can be sorted by descending length with
string = 'Joe John Bill Juan Bill'
x = string.split.sort_by(&:length).reverse.uniq