Module: Screen
Instance Method Summary collapse
- #clear! ⇒ Object
- #height ⇒ Object
- #hide_cursor ⇒ Object
- #print(text) ⇒ Object
- #suggest(x, y) ⇒ Object
- #width ⇒ Object
Instance Method Details
#clear! ⇒ Object
4 5 6 |
# File 'lib/screen.rb', line 4 def clear! print "\e[2J\e[f" end |
#height ⇒ Object
12 13 14 |
# File 'lib/screen.rb', line 12 def height `tput lines`.to_i end |
#hide_cursor ⇒ Object
8 9 10 |
# File 'lib/screen.rb', line 8 def hide_cursor print "\e[#{height};#{width}H" end |
#print(text) ⇒ Object
16 17 18 |
# File 'lib/screen.rb', line 16 def print(text) Kernel.print text end |
#suggest(x, y) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/screen.rb', line 20 def suggest(x, y) y.times do |n| print "\n" if n.nonzero? print "\u2588" * x end end |
#width ⇒ Object
27 28 29 |
# File 'lib/screen.rb', line 27 def width `tput cols`.to_i end |