Let's say I had an array of objects. The objects' class had an instance variable called "var1". How would I sort the array based on this "var1" instance variable? Thanks in advance.
EDIT: I think I just figured it out, is this right?
array.sort! {|a, b| a.var1 <=> b.var1}