Class: ProgressBar::Base
- Inherits:
-
Object
- Object
- ProgressBar::Base
- Defined in:
- lib/progress-bar.rb
Instance Attribute Summary collapse
-
#i ⇒ Object
(also: #to_i)
Returns the value of attribute i.
-
#max ⇒ Object
Returns the value of attribute max.
-
#startts ⇒ Object
Returns the value of attribute startts.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #change_progress ⇒ Object
- #change_text ⇒ Object
- #done_dur ⇒ Object
- #done_rel ⇒ Object
- #error(text) ⇒ Object
- #finish ⇒ Object
- #increment!(x = nil) ⇒ Object (also: #inc!)
-
#initialize(max = nil, text = nil, **_options) ⇒ Base
constructor
A new instance of Base.
- #possible? ⇒ Boolean
- #start ⇒ Object
- #total_dur ⇒ Object
Constructor Details
#initialize(max = nil, text = nil, **_options) ⇒ Base
Returns a new instance of Base.
21 22 23 |
# File 'lib/progress-bar.rb', line 21 def initialize max = nil, text = nil, ** @startts, @max, @i, @text = nil, max || 100, 0, text || '' end |
Instance Attribute Details
#i ⇒ Object Also known as: to_i
Returns the value of attribute i.
19 20 21 |
# File 'lib/progress-bar.rb', line 19 def i @i end |
#max ⇒ Object
Returns the value of attribute max.
19 20 21 |
# File 'lib/progress-bar.rb', line 19 def max @max end |
#startts ⇒ Object
Returns the value of attribute startts.
20 21 22 |
# File 'lib/progress-bar.rb', line 20 def startts @startts end |
#text ⇒ Object
Returns the value of attribute text.
19 20 21 |
# File 'lib/progress-bar.rb', line 19 def text @text end |
Instance Method Details
#change_progress ⇒ Object
57 |
# File 'lib/progress-bar.rb', line 57 def change_progress() end |
#change_text ⇒ Object
58 |
# File 'lib/progress-bar.rb', line 58 def change_text() end |
#done_dur ⇒ Object
45 |
# File 'lib/progress-bar.rb', line 45 def done_dur() Time.now-@startts end |
#done_rel ⇒ Object
44 |
# File 'lib/progress-bar.rb', line 44 def done_rel() 100.0*i/max end |
#error(text) ⇒ Object
56 |
# File 'lib/progress-bar.rb', line 56 def error( text) end |
#finish ⇒ Object
59 |
# File 'lib/progress-bar.rb', line 59 def finish() end |
#increment!(x = nil) ⇒ Object Also known as: inc!
41 |
# File 'lib/progress-bar.rb', line 41 def increment!( x = nil) self.i += (x || 1) end |
#possible? ⇒ Boolean
60 |
# File 'lib/progress-bar.rb', line 60 def possible?() false end |
#start ⇒ Object
25 26 27 28 29 |
# File 'lib/progress-bar.rb', line 25 def start at_exit {finish} @startts = Time.now self end |
#total_dur ⇒ Object
47 48 49 |
# File 'lib/progress-bar.rb', line 47 def total_dur done_dur * max / i end |