class TinyProgressbar
Constants
- CR
- FORMAT
- VERSION
Attributes
goal[R]
now[R]
Public Class Methods
new(goal)
click to toggle source
# File lib/tiny_progressbar.rb, line 8 def initialize(goal) @goal = goal @now = 0 display end
Public Instance Methods
clear()
click to toggle source
進捗表示を消去する
# File lib/tiny_progressbar.rb, line 22 def clear print CR + ' ' * 100 + CR end
succeed()
click to toggle source
# File lib/tiny_progressbar.rb, line 15 def succeed @now += 1 back_cursor display end
Private Instance Methods
back_cursor()
click to toggle source
同じ行に表示するためCR文字列でカーソルを戻す
# File lib/tiny_progressbar.rb, line 29 def back_cursor print CR end
display()
click to toggle source
進捗状況を表示する
# File lib/tiny_progressbar.rb, line 34 def display print FORMAT % ['=' * (30 * @now / @goal), @now, @goal] end