Module: Terminal
- Defined in:
- lib/terminal/screen.rb,
lib/terminal.rb,
lib/terminal/cli.rb,
lib/terminal/cache.rb,
lib/terminal/engine.rb,
lib/terminal/preview.rb,
lib/terminal/version.rb,
lib/terminal/renderer.rb
Overview
A fake terminal screen. Usage is like this:
screen = Screen.new screen.x = 10 screen.y = 10 screen.write(‘h’)
Will essentially create a 10 x 10 grid with empty characters, and at the 10,10 spot element, there will be a ‘h’. Co-ordinates start at 0,0
It also supports writing colors. So if you were to change the color like so:
screen.color(“42”)
Ever new character that you write, will be stored with that color information.
When turned into a string, the screen class creates ANSI escape characters, that the renderer class gsubs out.
e[fg32;bg42; e[fgi91;; e[fgx102;bgx102; e[0m
Are some of the examples of the escape sequences that this will render.
Defined Under Namespace
Modules: Cache Classes: CLI, Engine, Preview, Renderer, Screen
Constant Summary collapse
- VERSION =
"1.0.0"
Class Method Summary collapse
Class Method Details
.render(output, options = {}) ⇒ Object
10 11 12 |
# File 'lib/terminal.rb', line 10 def self.render(output, = {}) Terminal::Renderer.new(output, ).render end |