Class: ProgressBar::Base
- Inherits:
-
Object
- Object
- ProgressBar::Base
- Defined in:
- lib/progress-bar.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#i ⇒ Object
(also: #to_i)
Returns the value of attribute i.
-
#max ⇒ Object
Returns the value of attribute max.
-
#start ⇒ Object
Returns the value of attribute start.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #change_error ⇒ Object
- #change_progress ⇒ Object
- #change_text ⇒ Object
- #done_dur ⇒ Object
- #done_rel ⇒ Object
- #finish ⇒ Object
- #increment!(x = nil) ⇒ Object (also: #inc!)
-
#initialize(max = nil, text = nil) ⇒ Base
constructor
A new instance of Base.
- #total_dur ⇒ Object
Constructor Details
#initialize(max = nil, text = nil) ⇒ Base
Returns a new instance of Base.
18 19 20 |
# File 'lib/progress-bar.rb', line 18 def initialize max = nil, text = nil @start, @max, @i, @text, @error = Time.now, max || 100, 0, text || '', nil end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
16 17 18 |
# File 'lib/progress-bar.rb', line 16 def error @error end |
#i ⇒ Object Also known as: to_i
Returns the value of attribute i.
16 17 18 |
# File 'lib/progress-bar.rb', line 16 def i @i end |
#max ⇒ Object
Returns the value of attribute max.
16 17 18 |
# File 'lib/progress-bar.rb', line 16 def max @max end |
#start ⇒ Object
Returns the value of attribute start.
17 18 19 |
# File 'lib/progress-bar.rb', line 17 def start @start end |
#text ⇒ Object
Returns the value of attribute text.
16 17 18 |
# File 'lib/progress-bar.rb', line 16 def text @text end |
Instance Method Details
#change_error ⇒ Object
54 |
# File 'lib/progress-bar.rb', line 54 def change_error() end |
#change_progress ⇒ Object
52 |
# File 'lib/progress-bar.rb', line 52 def change_progress() end |
#change_text ⇒ Object
53 |
# File 'lib/progress-bar.rb', line 53 def change_text() end |
#done_dur ⇒ Object
36 |
# File 'lib/progress-bar.rb', line 36 def done_dur() Time.now-@start end |
#done_rel ⇒ Object
35 |
# File 'lib/progress-bar.rb', line 35 def done_rel() 100.0*i/max end |
#finish ⇒ Object
55 |
# File 'lib/progress-bar.rb', line 55 def finish() end |
#increment!(x = nil) ⇒ Object Also known as: inc!
32 |
# File 'lib/progress-bar.rb', line 32 def increment!( x = nil) self.i += (x || 1) end |
#total_dur ⇒ Object
38 39 40 |
# File 'lib/progress-bar.rb', line 38 def total_dur done_dur * max / i end |