class NHKore::NoProgressBar
@author Jonathan Bradley Whited @since 0.2.0
Constants
- MAX_PUT_INTERVAL
- MSG
- PUT_INTERVAL
Public Class Methods
new(title,total:,**tokens)
click to toggle source
Calls superclass method
# File lib/nhkore/app.rb, line 584 def initialize(title,total:,**tokens) super() @tokens = {title: title,total: total} reset @tokens.merge!(tokens) end
Public Instance Methods
advance(progress=1)
click to toggle source
# File lib/nhkore/app.rb, line 600 def advance(progress=1) total = @tokens[:total] progress = @tokens[:progress] + progress progress = total if progress > total percent = (progress.to_f / total.to_f * 100.0).round @tokens[:percent] = percent @tokens[:progress] = progress if percent < 99.0 # Only output at certain intervals. advance = @tokens[:advance] i = 0.0 while i <= MAX_PUT_INTERVAL if advance < i break if percent >= i # Output return # Don't output end i += PUT_INTERVAL end end @tokens[:advance] = percent puts to_s end
finish()
click to toggle source
# File lib/nhkore/app.rb, line 629 def finish advance(@tokens[:total]) end
reset()
click to toggle source
# File lib/nhkore/app.rb, line 594 def reset @tokens[:advance] = 0 @tokens[:percent] = 0 @tokens[:progress] = 0 end
start()
click to toggle source
# File lib/nhkore/app.rb, line 633 def start puts to_s end
to_s()
click to toggle source
# File lib/nhkore/app.rb, line 637 def to_s return MSG % @tokens end