Pixel sorter written in Ruby