Instead of relying on the $HOME environment variable to set correctly, which can be a problem when using shared network computers for development, you can get this from Ruby using:
require 'etc' open ("#{Etc.getpwuid.dir}/some_file")
I believe that this identifies the currently logged-in user and gets their home directory, rather than relying on the $HOME global environment variable. This is an alternative solution to the above. I suppose.
Voke Ransom Anighoro Feb 02 2018-12-12T00: 00Z
source share