Class: TinyProgressbar
- Inherits:
-
Object
- Object
- TinyProgressbar
- Defined in:
- lib/tiny_progressbar.rb,
lib/tiny_progressbar/version.rb
Constant Summary collapse
- CR =
"\r"- FORMAT =
'[%-30s] (%03d/%03d done)'- VERSION =
'0.0.1'
Instance Attribute Summary collapse
-
#goal ⇒ Object
readonly
Returns the value of attribute goal.
-
#now ⇒ Object
readonly
Returns the value of attribute now.
Instance Method Summary collapse
-
#clear ⇒ Object
進捗表示を消去する.
-
#initialize(goal) ⇒ TinyProgressbar
constructor
A new instance of TinyProgressbar.
- #succeed ⇒ Object
Constructor Details
#initialize(goal) ⇒ TinyProgressbar
Returns a new instance of TinyProgressbar.
8 9 10 11 12 |
# File 'lib/tiny_progressbar.rb', line 8 def initialize(goal) @goal = goal @now = 0 display end |
Instance Attribute Details
#goal ⇒ Object (readonly)
Returns the value of attribute goal.
13 14 15 |
# File 'lib/tiny_progressbar.rb', line 13 def goal @goal end |
#now ⇒ Object (readonly)
Returns the value of attribute now.
13 14 15 |
# File 'lib/tiny_progressbar.rb', line 13 def now @now end |
Instance Method Details
#clear ⇒ Object
進捗表示を消去する
22 23 24 |
# File 'lib/tiny_progressbar.rb', line 22 def clear print CR + ' ' * 100 + CR end |
#succeed ⇒ Object
15 16 17 18 19 |
# File 'lib/tiny_progressbar.rb', line 15 def succeed @now += 1 back_cursor display end |