Class: ProgressBar::Base

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

Direct Known Subclasses

Console, KDE, KDialog

Instance Attribute Summary collapse

Instance Method Summary collapse

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, **_options
	@startts, @max, @i, @text = nil, max || 100, 0, text || ''
end

Instance Attribute Details

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

#maxObject

Returns the value of attribute max.



19
20
21
# File 'lib/progress-bar.rb', line 19

def max
  @max
end

#starttsObject

Returns the value of attribute startts.



20
21
22
# File 'lib/progress-bar.rb', line 20

def startts
  @startts
end

#textObject

Returns the value of attribute text.



19
20
21
# File 'lib/progress-bar.rb', line 19

def text
  @text
end

Instance Method Details

#change_progressObject



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

def change_progress()  end

#change_textObject



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

def change_text()  end

#done_durObject



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

def done_dur() Time.now-@startts end

#done_relObject



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

#finishObject



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

Returns:

  • (Boolean)


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

def possible?()  false  end

#startObject



25
26
27
28
29
# File 'lib/progress-bar.rb', line 25

def start
	at_exit {finish}
	@startts = Time.now
	self
end

#total_durObject



47
48
49
# File 'lib/progress-bar.rb', line 47

def total_dur
	done_dur * max / i
end