- 6 months ago 24
Ruby Question

Can a Ruby script tell what directory it’s in?

Inspired by "Can a Bash script tell which directory it is stored in?", what's the Ruby way to do this?


File.dirname(__FILE__) will give you the path relative to the script being run. File.expand_path(File.dirname(__FILE__)) will give you the absolute path.