Is there a tmpfs kind of solution where I can write into Ruby's memory which only persists until that ruby instance is complete.
File.write('/ruby_tmpfs/path/to/file', 'Some glorious content')
It get consumed in same script like this:
read_file_function_i_cannot_change_which_expects_file_path('/ruby_tmpfs/path/to/file')
I've never heard of such a feature in Ruby or its stdlib.
Searching for "ruby in-memory file" revealed memfs, which I have never heard of before today, but sounds relevant.
Using only the stdlib, mktmpdir is probably the best alternative. It will use non-volatile storage, but the OS will eventually delete it.