Class: ProgressBar::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/progress-bar.rb

Direct Known Subclasses

Console, KDialog

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#errorObject

Returns the value of attribute error.



16
17
18
# File 'lib/progress-bar.rb', line 16

def error
  @error
end

#iObject 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

#maxObject

Returns the value of attribute max.



16
17
18
# File 'lib/progress-bar.rb', line 16

def max
  @max
end

#startObject

Returns the value of attribute start.



17
18
19
# File 'lib/progress-bar.rb', line 17

def start
  @start
end

#textObject

Returns the value of attribute text.



16
17
18
# File 'lib/progress-bar.rb', line 16

def text
  @text
end

Instance Method Details

#change_errorObject



54
# File 'lib/progress-bar.rb', line 54

def change_error()  end

#change_progressObject



52
# File 'lib/progress-bar.rb', line 52

def change_progress()  end

#change_textObject



53
# File 'lib/progress-bar.rb', line 53

def change_text()  end

#done_durObject



36
# File 'lib/progress-bar.rb', line 36

def done_dur() Time.now-@start end

#done_relObject



35
# File 'lib/progress-bar.rb', line 35

def done_rel() 100.0*i/max end

#finishObject



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_durObject



38
39
40
# File 'lib/progress-bar.rb', line 38

def total_dur
	done_dur * max / i
end