sorting the children of an object

Something like: elements.sort{ |x,y| x.position <=> y.position }