Solicitar información al usuario y no tener que volver a preguntar.

Quiero solicitar la entrada del usuario, pero solo quiero hacerlo una vez (posiblemente guardar la información dentro del programa), es decir, algo como esto:

print "Enter your name (you will only need to do this once): "
name = gets.chomp

str = "Hello there #{name}" #<= As long as the user has put their name in the very first 
# time the program was run, I want them to never have to put thier name in again

¿Cómo puedo hacer esto dentro de un programa Ruby?

Este programa será ejecutado por múltiples usuarios durante todo el día en múltiples sistemas. Intenté almacenarlo en la memoria, pero obviamente eso falló porque entiendo que la memoria se borra cada vez que un programa Ruby deja de ejecutarse.

Mis intentos:

def capture_user
  print 'Enter your name: '
  name = gets.chomp
end
#<= works but user has to put in name multiple times
def capture_name      
  if File.read('name.txt') == ''
    print "\e[36mEnter name to appear on email (you will only have to do this once):\e[0m "
    @esd_user = gets.chomp
    File.open('name.txt', 'w') { |s| s.puts(@esd_user) }
  else
    @esd_user = File.read('name.txt')
  end
end
#<= works but there has to be a better way to do this?
require 'tempfile'

def capture_name
  file = Tempfile.new('user')
  if File.read(file) == ''
    print "\e[36mEnter name to appear on email (you will only have to do this once):\e[0m "
    @esd_user = gets.chomp
    File.open(file, 'w') { |s| s.puts(@esd_user) }
  else
    @esd_user = File.read(file)
  end
end
#<= Also used a tempfile, this is a little bit over kill I think,
# and doesn't really help because the users can't access their Appdata

Respuestas a la pregunta(2)

Su respuesta a la pregunta