Class: ShintyokuDoudesuka::Talk
- Inherits:
-
Object
- Object
- ShintyokuDoudesuka::Talk
- Defined in:
- lib/shintyoku_doudesuka.rb
Constant Summary collapse
- SPEED =
3.0
Instance Method Summary collapse
- #comment ⇒ Object
- #finished? ⇒ Boolean
-
#initialize ⇒ Talk
constructor
A new instance of Talk.
- #raise_problem ⇒ Object
- #recover ⇒ Object
- #show ⇒ Object
- #succeed ⇒ Object
Constructor Details
Instance Method Details
#comment ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/shintyoku_doudesuka.rb', line 34 def comment print "#{min[@step.to_i,100]}% " print '進捗どうですか > ' if @speed > 2.0 print 'いい感じです' else print 'ダメです' end end |
#finished? ⇒ Boolean
30 31 32 |
# File 'lib/shintyoku_doudesuka.rb', line 30 def finished? @step >= 100 end |
#raise_problem ⇒ Object
22 23 24 |
# File 'lib/shintyoku_doudesuka.rb', line 22 def raise_problem @speed = SPEED * rand(10) * 0.1 end |
#recover ⇒ Object
26 27 28 |
# File 'lib/shintyoku_doudesuka.rb', line 26 def recover @speed = SPEED end |
#show ⇒ Object
17 18 19 20 |
# File 'lib/shintyoku_doudesuka.rb', line 17 def show l = (@step/5).to_i print "[#{"="*l}#{" "*(20-l)}] " end |
#succeed ⇒ Object
12 13 14 15 |
# File 'lib/shintyoku_doudesuka.rb', line 12 def succeed @step += @speed show end |