This would be a Ruby feature not a SketchUp API feature.
Read up on the block forms of methods such as min, max, and sort.
You will need to write a method that takes the target column as an argument, then likely uses that to control a implementation of a sort block.
At the most basic, such a method would look similar to this:
(where i is the
0 based column index)
a[i] <=> b[i]
<=> operator requires the objects referenced to be
Comparable, ie if you test their class’s ancestors, the
Comparable module will be listed in the result, as one of the class’s ancestors,…
OR they have a
<=> method defined for their class.
String should not be a problem, and if your get the x,y and z from
Point3d objects, they will return
Length objects. Likewise for the h, w & d from
Length has a special
<=> override method defined.
Also ref: http://ruby-doc.org/core-2.0.0/Array.html#method-i-sort