ruby order array of objects code example Example: ruby sort an object objects.sort_by {|obj| obj.attribute} # OR objects.sort_by(&:attribute)