The Ruby core Array#sort method ? It also takes a block where you can code a custom sorting algorithm.
Yea, that’s a bit vague. What are the keys ? If the numeric values are the hash values, then are the keys going to just be integers? If so, there is no need for a separate hash since you sorted the array and access by integer index is built-in.
Ok I start with an un-ordered array with a bunch of window names: [“window1”, “window2”, “window7”, “window3”]
The names of the windows does not matter in this array other than for each listed window in the list there exists a library attribute that contains its (the windows) location from the origin of the wall panel, some float, lets say 74.5323 inches.
Since the windows can be inserted into the wall in any location or order the location of each window is in no way indicated by the name of that window.
What I would like is an ordered array/list the windows locations ie. [42.253, 52.25, 70.2343, 112.5] and a corresponding array/list with window names listed and sorted to match the same order as the location list.