LoginSignup
0
0

More than 1 year has passed since last update.

インスタンスの属性で並び替える

Last updated at Posted at 2022-11-27

sort_by

sort_by {|item| ... } -> [object]

出典

Sorting an array of objects in Ruby by object attribute?

サイトを見つけた時のタイトルです。
自分が見つけたいものがあるような単語が並んでいたのでサイトを開いてみました。

objects.sort_by {|obj| obj.attribute}

できた

これで属性で並び替えることができた。

出典

感想

英語のサイトを見て問題が解決できたので、何か気持ちがいいです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0