Module: Termular::Console

Defined in:
lib/termular/console.rb

Class Method Summary collapse

Class Method Details

.buffered_print {|buff| ... } ⇒ Object

Yields:

  • (buff)


40
41
42
43
44
# File 'lib/termular/console.rb', line 40

def self.buffered_print
  buff = ""
  yield buff
  print buff
end

.clearObject



16
17
18
# File 'lib/termular/console.rb', line 16

def self.clear
  "\e[H\e[2J"
end

.clear_lineObject



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

.colsObject



32
33
34
# File 'lib/termular/console.rb', line 32

def self.cols
  Ncurses.getmaxx Ncurses.stdscr
end

.initObject



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

.resetObject



28
29
30
# File 'lib/termular/console.rb', line 28

def self.reset
  "\e[m"
end

.rowsObject



36
37
38
# File 'lib/termular/console.rb', line 36

def self.rows
  Ncurses.getmaxy Ncurses.stdscr
end