Save Files for a Terminal/Cmd-prompt RPG? (File I/O)

Hi, I’m new to the forum. I have some basic understanding (very basic)
of Ruby, C/C++, Java, and Python. I just have a question or two about
how to implement a nice feature for a bash/prompt game.

I was learning about File I/O in Ruby when I realized that (if I could
do it) it would be a nice idea for use in a console RPG (role-playing
game) I’m making. (Mind you, I know that this isn’t “true” game
development; it’s just a toy project to build skills and examples of
Ruby for me). So, what I want to do is this:

  1. Write/overwrite a new save file for each game the user decides to
    save at “save game?” prompts.
  2. Read in a save file with the last state of the game and player info.
  3. Use this data to continue the game.

I’ve done a little bit of file I/O in each language I (barely) know, but
I like Ruby because it’s simple, fun, and for what I’m doing, fast. I’m
mostly self-taught in computer science; I only took one CS course (intro
to CS w/ Python) at my local college, but I still love the subject.

I tried searching for a similar tutorial on the internet, but everything
on file I/O seems to be geared towards other things. Does anybody know
how I could implement this idea, or at least have some good psuedocode
or an algorithm or something I could learn more about it with?
Thanks in advance!