Ruby で条件付きの最大値、最小値を取得する

#max_by#min_by を使用します。

["homuhomu", "an", "mado"].max_by { |it| it.length}
# => "homuhomu"

最初 #max 使っててなんで動作しないのかと悩んでた…。