Hassan Schroeder wrote in post #1074525:
Yes, I'm learning to program on my own... I don't believe anyone would
pay for my work :-)
Thanks, you were right - it is writing to the file and I can see it
after closing.
Can I follow with one last question...
I have written a method, saved it in a table, and this is what I am
writing to the temp file. Can I require the file and then call the
method (getting the returned arguments) from the temp file as it is
saved as a .rb file? eg...
def format_q_gen
file = Tempfile.new([generator_file_name, ".rb"],
"./lib/generators")
file.write(question)
returned_question = generator_file_name # Calls the method in the
tempfile
formatted = {
question: q["question_1"],
correct_answer_letter: "a"
}
file.close
file.unlink
end