Module: Arachni::Support::Mixins::Terminal
Overview
Terminal manipulation methods.
Instance Method Summary collapse
-
#clear_screen ⇒ Object
Clear the bottom of the screen.
- #empty_screen ⇒ Object
-
#flush ⇒ Object
Flushes the STDOUT buffer.
-
#move_to_home ⇒ Object
Moves cursor top left to its home.
-
#reprint(str = '') ⇒ Object
Clears the line before printing.
-
#reputs(str = '') ⇒ Object
Clears the line before printing using `puts`.
- #restr(str = '') ⇒ Object
Instance Method Details
#clear_screen ⇒ Object
Clear the bottom of the screen
39 40 41 |
# File 'lib/arachni/support/mixins/terminal.rb', line 39 def clear_screen print "\e[2J" end |
#empty_screen ⇒ Object
43 44 45 46 47 48 |
# File 'lib/arachni/support/mixins/terminal.rb', line 43 def empty_screen move_to_home rows, cols = $stdin.winsize (rows - 1).times{ puts ' ' * cols } move_to_home end |
#flush ⇒ Object
Flushes the STDOUT buffer
56 57 58 |
# File 'lib/arachni/support/mixins/terminal.rb', line 56 def flush $stdout.flush end |
#move_to_home ⇒ Object
Moves cursor top left to its home
51 52 53 |
# File 'lib/arachni/support/mixins/terminal.rb', line 51 def move_to_home print "\e[H" end |
#reprint(str = '') ⇒ Object
Clears the line before printing.
30 31 32 |
# File 'lib/arachni/support/mixins/terminal.rb', line 30 def reprint( str = '' ) print restr( str ) end |
#reputs(str = '') ⇒ Object
Clears the line before printing using `puts`.
22 23 24 |
# File 'lib/arachni/support/mixins/terminal.rb', line 22 def reputs( str = '' ) reprint str + "\n" end |
#restr(str = '') ⇒ Object
34 35 36 |
# File 'lib/arachni/support/mixins/terminal.rb', line 34 def restr( str = '' ) "\e[0K" + str end |