Sha256: b48a4d0384b705b5d028ba544530341194ceb48194b74d0c023f1cfaac0d85a1

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 KB

Contents

=begin
    Copyright 2010-2014 Tasos Laskos <tasos.laskos@arachni-scanner.com>

    This file is part of the Arachni Framework project and is subject to
    redistribution and commercial restrictions. Please see the Arachni Framework
    web site for more information on licensing and terms of use.
=end

require 'io/console'

module Arachni
module Support
module Mixins

# Terminal manipulation methods.
module Terminal

    # Clears the line before printing using `puts`.
    #
    # @param    [String]    str
    #   String to output
    def reputs( str = '' )
        reprint str + "\n"
    end

    # Clears the line before printing.
    #
    # @param    [String]    str
    #   String to output.
    def reprint( str = '' )
        print restr( str )
    end

    def restr( str = '' )
        "\e[0K" + str
    end

    # Clear the bottom of the screen
    def clear_screen
        print "\e[2J"
    end

    def empty_screen
        move_to_home
        rows, cols = $stdin.winsize
        (rows - 1).times{ puts ' ' * cols }
        move_to_home
    end

    # Moves cursor top left to its home
    def move_to_home
        print "\e[H"
    end

    # Flushes the STDOUT buffer
    def flush
        $stdout.flush
    end

    extend self
end

end
end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arachni-1.0.6 lib/arachni/support/mixins/terminal.rb
arachni-1.0.5 lib/arachni/support/mixins/terminal.rb
arachni-1.0.4 lib/arachni/support/mixins/terminal.rb
arachni-1.0.3 lib/arachni/support/mixins/terminal.rb
arachni-1.0.2 lib/arachni/support/mixins/terminal.rb
arachni-1.0.1 lib/arachni/support/mixins/terminal.rb
arachni-1.0 lib/arachni/support/mixins/terminal.rb