class MiniProgressbar

Constants

CR
FORMAT
VERSION

Attributes

goal[R]
now[R]

Public Class Methods

new(goal) click to toggle source
# File lib/mini_progressbar.rb, line 8
def initialize(goal)
      @goal = goal
      @now = 0
      display
end

Public Instance Methods

clear() click to toggle source

進捗状況をを消去する

# File lib/mini_progressbar.rb, line 21
def clear
      print CR + " " * 100 + CR
end
succeed() click to toggle source
# File lib/mini_progressbar.rb, line 15
def succeed
      @now += 1
      back_cursor
      display
end

Private Instance Methods

back_cursor() click to toggle source

同じ行に表示するためCR文字でカーソルを戻す

# File lib/mini_progressbar.rb, line 27
def back_cursor
      print CR
end
display() click to toggle source

進捗状況を表示する

# File lib/mini_progressbar.rb, line 31
def display
      print FORMAT % [("=" * (30 * @now / @goal)), @now, @goal]
end