Project

tty-live

0.0
No release in over 3 years
Refresh tty
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 0.7.1
 Project Readme

TTY::Live

This is a wrapper for TTY::Cursor to help you refresh console.

Installation

bundle add tty-live

If bundler is not being used to manage dependencies, install the gem by executing:

gem install tty-live

Usage

require '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

puts

And 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)

Development

Follow your heart.

License

The gem is available as open source under the terms of the MIT License.