Class: Rex::Ui::Text::ProgressTracker

Inherits:
ProgressTracker show all
Defined in:
lib/rex/ui/text/progress_tracker.rb

Overview

This module implements progress tracking against a text interface.

Defined Under Namespace

Classes: UnitTest

Instance Attribute Summary collapse

Attributes inherited from ProgressTracker

#pos, #start, #stop

Instance Method Summary collapse

Methods inherited from ProgressTracker

#range=, #reset, #step

Constructor Details

#initialize(output) ⇒ ProgressTracker

Returns a new instance of ProgressTracker.



14
15
16
17
18
19
# File 'lib/rex/ui/text/progress_tracker.rb', line 14

def initialize(output)
	self.output = output
	self.start  = 0
	self.stop   = 0
	self.pos    = 0
end

Instance Attribute Details

#outputObject

Returns the value of attribute output.



50
51
52
# File 'lib/rex/ui/text/progress_tracker.rb', line 50

def output
  @output
end

Instance Method Details

#abort(msg = '') ⇒ Object

Progress has been aborted, the reason is supplied in msg.



46
47
48
# File 'lib/rex/ui/text/progress_tracker.rb', line 46

def abort(msg = '')
	output.print_error("fatal: #{msg}")
end

#error(msg = '') ⇒ Object

An error occurred that may result in aborting the progress.



39
40
41
# File 'lib/rex/ui/text/progress_tracker.rb', line 39

def error(msg = '')
	output.print_error(msg)
end

#status(msg = '') ⇒ Object

Passes a generic status message that isn’t necessarily associated with a step event.



25
26
27
# File 'lib/rex/ui/text/progress_tracker.rb', line 25

def status(msg = '')
	output.print_status(msg)
end

#step_status(msg = '') ⇒ Object

Updates the status associated with the current step.



32
33
34
# File 'lib/rex/ui/text/progress_tracker.rb', line 32

def step_status(msg = '')
	output.print_status("#{pos}: #{msg}") if (msg and msg.length > 0)
end