Class: Rex::Ui::Text::ProgressTracker
- Inherits:
-
ProgressTracker
- Object
- ProgressTracker
- Rex::Ui::Text::ProgressTracker
- Defined in:
- lib/rex/ui/text/progress_tracker.rb
Overview
This module implements progress tracking against a text interface.
Instance Attribute Summary collapse
-
#output ⇒ Object
Returns the value of attribute output.
Attributes inherited from ProgressTracker
Instance Method Summary collapse
-
#abort(msg = '') ⇒ Object
Progress has been aborted, the reason is supplied in msg.
-
#error(msg = '') ⇒ Object
An error occurred that may result in aborting the progress.
-
#initialize(output) ⇒ ProgressTracker
constructor
A new instance of ProgressTracker.
-
#status(msg = '') ⇒ Object
Passes a generic status message that isn’t necessarily associated with a step event.
-
#step_status(msg = '') ⇒ Object
Updates the status associated with the current step.
Methods inherited from ProgressTracker
Constructor Details
#initialize(output) ⇒ ProgressTracker
Returns a new instance of ProgressTracker.
15 16 17 18 19 20 |
# File 'lib/rex/ui/text/progress_tracker.rb', line 15 def initialize(output) self.output = output self.start = 0 self.stop = 0 self.pos = 0 end |
Instance Attribute Details
#output ⇒ Object
Returns the value of attribute output.
51 52 53 |
# File 'lib/rex/ui/text/progress_tracker.rb', line 51 def output @output end |
Instance Method Details
#abort(msg = '') ⇒ Object
Progress has been aborted, the reason is supplied in msg.
47 48 49 |
# File 'lib/rex/ui/text/progress_tracker.rb', line 47 def abort(msg = '') output.print_error("fatal: #{msg}") end |
#error(msg = '') ⇒ Object
An error occurred that may result in aborting the progress.
40 41 42 |
# File 'lib/rex/ui/text/progress_tracker.rb', line 40 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.
26 27 28 |
# File 'lib/rex/ui/text/progress_tracker.rb', line 26 def status(msg = '') output.print_status(msg) end |
#step_status(msg = '') ⇒ Object
Updates the status associated with the current step.
33 34 35 |
# File 'lib/rex/ui/text/progress_tracker.rb', line 33 def step_status(msg = '') output.print_status("#{pos}: #{msg}") if (msg and msg.length > 0) end |