Method: Syncmind::PersonalityQuiz.planning

Defined in:
lib/syncmind.rb

.planningObject

Do you plan far ahead, or at the last minute?



491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
# File 'lib/syncmind.rb', line 491

def self.planning
  system("clear")

  print "
  Do you like to plan at the last minute?
  
  [A] I think I forgot to get something.
  [B] I think I got all my things.
  
  >> "; answer = gets.chomp
  
  if    answer == "A" # Writes A answer to script file.
    old_script = File.read("data/script.txt")
  
    open("data/script.txt", "w") { |f|
      f.puts "I think I forgot to get something."
      
      f.puts old_script
    }
  elsif answer == "B" # Writes B answer to script file.
    old_script = File.read("data/script.txt")
  
    open("data/script.txt", "w") { |f|
      f.puts "I think I got all my things."
      
      f.puts old_script
    }
  else                # Picks a default answer.
    old_script = File.read("data/script.txt")
  
    open("data/script.txt", "w") { |f|
      f.puts "I think I got all my things."
      
      f.puts old_script
    }
  end
end