From: Dave Thomas Date: 2000-06-06T06:58:05-05:00 Subject: [ruby-talk:03123] Re: Min and max? schneik@us.ibm.com writes: > So in addition to this: > > # ruby -e 'print ["computer ","Boston ", "Austin ", "another "].sort, > "\n"' > Austin Boston another computer > > which isn't what I normally want, I would like to do this: > > # ruby -e 'print ["computer ","Boston ", "Austin ", "another > "].dict_sort, "\n"' > another Austin Boston computer If you're going this route, a more Ruby-ish alternative might be to have various classes (such as string) define a set of proc objects that had different sort behaviors: [ ...] sort &String::dict_order [ ...] sort &String::case_insensitive_order [ ...] sort &Number::ignore_sign_order and so on. Alternatively (and less minimally) have the classes each wrap 'sort' [ ...] String::sort_dict_order [ ...] String::sort_case_insensitive_order [ ...] Number::sort_ignore_sign_order Regards Dave