Alphabetical sorter
// That's nothing new, except this sorts strings starting with a number correctly!
# --- # Sorting # --- def <=>(other) regex = /^[\d]+/ if self.title =~ regex our_num = Regexp.last_match[0].to_i if other.title =~ regex other_num = Regexp.last_match[0].to_i return our_num <=> other_num end end self.title <=> other.title end