Bubble sort using Ruby code