class Rex::Ui::ProgressTracker
This module tracks the progress of an arbitrary task in a generic fashion. The actual implementation is left up to the thing that derives from this module.
Attributes
pos[RW]
The current position in the progress.
start[R]
The start of the progress.
stop[RW]
The last position in the progress.
Public Class Methods
new()
click to toggle source
# File lib/rex/ui/progress_tracker.rb, line 15 def initialize self.start = 0 self.stop = 0 self.pos = 0 end
Public Instance Methods
abort(msg = nil)
click to toggle source
Progress has been aborted, the reason is supplied in msg.
# File lib/rex/ui/progress_tracker.rb, line 77 def abort(msg = nil) end
error(msg = nil)
click to toggle source
An error occurred that may result in aborting the progress.
# File lib/rex/ui/progress_tracker.rb, line 71 def error(msg = nil) end
range=(rng)
click to toggle source
Sets start and step using a range.
# File lib/rex/ui/progress_tracker.rb, line 24 def range=(rng) self.start = rng.begin self.stop = rng.end end
reset(n = self.start)
click to toggle source
Resets the current step location.
# File lib/rex/ui/progress_tracker.rb, line 51 def reset(n = self.start) self.pos = n end
start=(start)
click to toggle source
Sets the start and resets the position.
# File lib/rex/ui/progress_tracker.rb, line 32 def start=(start) @start = start self.pos = start end
status(msg = nil)
click to toggle source
Passes a generic status message that isn’t necessarily associated with a step event.
# File lib/rex/ui/progress_tracker.rb, line 59 def status(msg = nil) end
step(status = nil, n = 1)
click to toggle source
Steps with a given message and step size.
# File lib/rex/ui/progress_tracker.rb, line 40 def step(status = nil, n = 1) self.pos += n if (self.pos + n <= self.stop) step_status(status) self.pos end
step_status(msg = nil)
click to toggle source
Updates the status associated with the current step.
# File lib/rex/ui/progress_tracker.rb, line 65 def step_status(msg = nil) end