Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. our_file = File.open("data.txt")
  2. puts our_file.read
  3. #############################################
  4. our_file = File.open("data.txt", "w")
  5. print "Enter the new contents of this file: "
  6. our_file.write gets.chomp
  7. our_file.close
  8. #############################################
  9. our_file = File.open("data.txt", "a+")
  10. print "What would you like to add to your file? "
  11. our_file.write "\n#{gets.chomp}"
  12. our_file.close
  13. #############################################
  14. our_file = File.open("data_hash.txt")
  15. person = eval(our_file.read)
  16.  
  17. puts "Current person's name is #{person[:name]}"
  18. print "What should the new name be? "
  19. person[:name] = gets.chomp
  20.  
  21. puts "#{person[:name]}'s last thought was \"#{person[:thought]}\""
  22. print "What is the new last thought? "
  23. person[:thought] = gets.chomp
  24.  
  25. puts person
  26.  
  27. new_file = File.open("data_hash.txt", "w")
  28. new_file.puts person
  29. new_file.close
  30. ############################################
  31. Quality tenants pay rent on time and
  32. take care of your property. To spot
  33. a quality tenant, look for these five
  34. attributes:
  35.  
  36. 1. Ability to afford rent
  37. 2. Job Stability
  38. 3. Paid rent on time in the past
  39. 4. Clean criminal record
  40. 5. Responsible and timely
  41. ############################################
  42. { name: "Kyle", type: "human", thought: "I never know what's going on." }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement