module Arachni::Support::Mixins::Terminal

Terminal manipulation methods.

Public Instance Methods

clear_screen() click to toggle source

Clear the bottom of the screen

# File lib/arachni/support/mixins/terminal.rb, line 39
def clear_screen
    print "\e[2J"
end
empty_screen() click to toggle source
# 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() click to toggle source

Flushes the STDOUT buffer

# File lib/arachni/support/mixins/terminal.rb, line 56
def flush
    $stdout.flush
end
move_to_home() click to toggle source

Moves cursor top left to its home

# File lib/arachni/support/mixins/terminal.rb, line 51
def move_to_home
    print "\e[H"
end
reprint( str = '' ) click to toggle source

Clears the line before printing.

@param [String] str

String to output.
# File lib/arachni/support/mixins/terminal.rb, line 30
def reprint( str = '' )
    print restr( str )
end
reputs( str = '' ) click to toggle source

Clears the line before printing using ‘puts`.

@param [String] str

String to output
# File lib/arachni/support/mixins/terminal.rb, line 22
def reputs( str = '' )
    reprint str + "\n"
end
restr( str = '' ) click to toggle source
# File lib/arachni/support/mixins/terminal.rb, line 34
def restr( str = '' )
    "\e[0K" + str
end