The relative library enhances Ruby's core and standard libraries to support naming, opening, and reading files relative to the Ruby file currently being interpreted (the contents of the __ FILE __ identifier). This functionality is especially useful in embedded Ruby (eruby, erb, erubis, etc.) where absolute paths or paths relative to the interpreter's current working directory are problematic (due to file system structures and working directories varying across platforms and web servers).
Gemfile gem 'relative', '~> 1.0.3'
install gem install relative