Infinite loop for counting the second in Ruby