Sorting an array of structs
- by keruilin
I have an array of structs called leaders. The struct class looks like this, for contextual info:
class Leader < Struct.new(:rank, :user); end
Two questions:
How do I sort the array of structs by rank?
How do I sort the array of structs by rank and by user.created_at?