Module: Termular::Console
- Defined in:
- lib/termular/console.rb
Class Method Summary collapse
- .buffered_print {|buff| ... } ⇒ Object
- .clear ⇒ Object
- .clear_line ⇒ Object
- .color(*col) ⇒ Object
- .cols ⇒ Object
- .init ⇒ Object
- .move(x, y) ⇒ Object
- .reset ⇒ Object
- .rows ⇒ Object
Class Method Details
.buffered_print {|buff| ... } ⇒ Object
40 41 42 43 44 |
# File 'lib/termular/console.rb', line 40 def self.buffered_print buff = "" yield buff print buff end |
.clear ⇒ Object
16 17 18 |
# File 'lib/termular/console.rb', line 16 def self.clear "\e[H\e[2J" end |
.clear_line ⇒ Object
20 21 22 |
# File 'lib/termular/console.rb', line 20 def self.clear_line "\e[0G\e[2K" end |
.color(*col) ⇒ Object
24 25 26 |
# File 'lib/termular/console.rb', line 24 def self.color(*col) Paint["|", *col].split("|").first end |
.cols ⇒ Object
32 33 34 |
# File 'lib/termular/console.rb', line 32 def self.cols Ncurses.getmaxx Ncurses.stdscr end |
.init ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/termular/console.rb', line 3 def self.init Ncurses.initscr Ncurses.raw Ncurses.noecho Ncurses.keypad Ncurses.stdscr, true Ncurses.refresh at_exit { Ncurses.endwin } end |
.move(x, y) ⇒ Object
12 13 14 |
# File 'lib/termular/console.rb', line 12 def self.move(x, y) "\e[#{y.to_i};#{x.to_i}H" end |
.reset ⇒ Object
28 29 30 |
# File 'lib/termular/console.rb', line 28 def self.reset "\e[m" end |
.rows ⇒ Object
36 37 38 |
# File 'lib/termular/console.rb', line 36 def self.rows Ncurses.getmaxy Ncurses.stdscr end |