This is a wrapper for TTY::Cursor to help you refresh console.
bundle add tty-liveIf bundler is not being used to manage dependencies, install the gem by executing:
gem install tty-liverequire 'tty-live'
live = TTY::Live.new
10.times do
sky = 10.times.map{100.times.map{rand(100) >= 99 ? '*' : ' '}.join}.join("\n")
live.update(sky)
sleep 1
end
putsAnd you can access TTY::Cursor's methods through TTY::Live instance:
# same as `print TTY::Cursor.up(5) + TTY::Cursor.forward(2)`
print live.up(5) + live.forward(2)Follow your heart.
The gem is available as open source under the terms of the MIT License.