class ProgressBar::Base

Attributes

i[R]
max[R]
startts[RW]
text[R]
to_i[R]

Public Class Methods

new(max = nil, text = nil, **_options) click to toggle source
# File lib/progress-bar.rb, line 21
def initialize max = nil, text = nil, **_options
        @startts, @max, @i, @text = nil, max || 100, 0, text || ''
end

Public Instance Methods

change_progress() click to toggle source
# File lib/progress-bar.rb, line 57
def change_progress()  end
change_text() click to toggle source
# File lib/progress-bar.rb, line 58
def change_text()  end
done_dur() click to toggle source
# File lib/progress-bar.rb, line 45
def done_dur() Time.now-@startts end
done_rel() click to toggle source
# File lib/progress-bar.rb, line 44
def done_rel() 100.0*i/max end
error( text) click to toggle source
# File lib/progress-bar.rb, line 56
def error( text)  end
finish() click to toggle source
# File lib/progress-bar.rb, line 59
def finish()  end
i=(x) click to toggle source
# File lib/progress-bar.rb, line 31
def i= x
        @i = x.to_i
        change_progress
end
inc!( x = nil)
Alias for: increment!
increment!( x = nil) click to toggle source
# File lib/progress-bar.rb, line 41
def increment!( x = nil) self.i += (x || 1) end
Also aliased as: inc!
max=(val) click to toggle source
# File lib/progress-bar.rb, line 36
def max= val
        @max = val
        change_progress
end
possible?() click to toggle source
# File lib/progress-bar.rb, line 60
def possible?()  false  end
start() click to toggle source
# File lib/progress-bar.rb, line 25
def start
        at_exit {finish}
        @startts = Time.now
        self
end
text=(x) click to toggle source
# File lib/progress-bar.rb, line 51
def text= x
        @text = x
        change_text
end
total_dur() click to toggle source
# File lib/progress-bar.rb, line 47
def total_dur
        done_dur * max / i
end