This will return the first instance of the longest string in an array:
["abcd","efgh","ijk"].max_by { |x| x.length } # => "abcd"
Similarly to this, is there a nice way to get an array of all strings with the maximal length?
["abcd","efgh","ijk"].some_trick ... # => ["abcd","efgh"]
Here we go :
Explanation :
{4=>["abcd", "efgh"], 3=>["ijk"]}[key, values]=>[4, ["abcd", "efgh"]]["abcd", "efgh"]