Module: SpecSelectorUtil::Terminal
- Included in:
- SpecSelector
- Defined in:
- lib/spec_selector/terminal.rb
Overview
The Terminal module contains methods concerned with terminal display function.
Instance Method Summary collapse
- #clear_frame ⇒ Object
- #close_alt_buffer ⇒ Object
- #hide_cursor ⇒ Object
- #open_alt_buffer ⇒ Object
- #position_cursor(row, col) ⇒ Object
- #reset_cursor ⇒ Object
- #reveal_cursor ⇒ Object
- #term_height ⇒ Object
- #term_width ⇒ Object
Instance Method Details
#clear_frame ⇒ Object
7 8 9 10 |
# File 'lib/spec_selector/terminal.rb', line 7 def clear_frame reset_cursor system("printf '\e[0J'") end |
#close_alt_buffer ⇒ Object
28 29 30 |
# File 'lib/spec_selector/terminal.rb', line 28 def close_alt_buffer system('tput rmcup') end |
#hide_cursor ⇒ Object
12 13 14 |
# File 'lib/spec_selector/terminal.rb', line 12 def hide_cursor system("printf '\e[?25l'") end |
#open_alt_buffer ⇒ Object
24 25 26 |
# File 'lib/spec_selector/terminal.rb', line 24 def open_alt_buffer system('tput smcup') end |
#position_cursor(row, col) ⇒ Object
40 41 42 |
# File 'lib/spec_selector/terminal.rb', line 40 def position_cursor(row, col) system("printf '\e[#{row};#{col}H'") end |
#reset_cursor ⇒ Object
32 33 34 |
# File 'lib/spec_selector/terminal.rb', line 32 def reset_cursor system("printf '\e[H'") end |
#reveal_cursor ⇒ Object
16 17 18 |
# File 'lib/spec_selector/terminal.rb', line 16 def reveal_cursor system("printf '\e[?25h'") end |
#term_height ⇒ Object
20 21 22 |
# File 'lib/spec_selector/terminal.rb', line 20 def term_height STDOUT.winsize[0] end |
#term_width ⇒ Object
36 37 38 |
# File 'lib/spec_selector/terminal.rb', line 36 def term_width STDOUT.winsize[1] end |