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