'How to create live changing text in ruby?

How to live changing in ruby, I receive API but it looks like:

the number is 1
the number is 2
the number is 3

it's normal because inside the loop and when I use cls on windows or clear on Debian, it clears the whole text on the terminal. I want to make it one line, any suggestions?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source