class ShintyokuDoudesuka::Talk

Constants

SPEED

Public Class Methods

new() click to toggle source
# File lib/shintyoku_doudesuka.rb, line 7
def initialize
  @step = 0.0
  @speed = SPEED
end

Public Instance Methods

comment() click to toggle source
# File lib/shintyoku_doudesuka.rb, line 34
def comment
  print "#{[(@step.to_i),100].min}% "
  print '進捗どうですか > '
  if @speed > 2.0
    print 'いい感じです'
  else
    print 'ダメです'
  end
end
finished?() click to toggle source
# File lib/shintyoku_doudesuka.rb, line 30
def finished?
  @step >= 100
end
raise_problem() click to toggle source
# File lib/shintyoku_doudesuka.rb, line 22
def raise_problem
  @speed = SPEED * rand(10) * 0.1
end
recover() click to toggle source
# File lib/shintyoku_doudesuka.rb, line 26
def recover
  @speed = SPEED
end
show() click to toggle source
# File lib/shintyoku_doudesuka.rb, line 17
def show
  l = (@step/5).to_i
  print "[#{"="*l}#{" "*(20-l)}] "
end
succeed() click to toggle source
# File lib/shintyoku_doudesuka.rb, line 12
def succeed
  @step += @speed
  show
end