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

前端 未结 4 790
遇见更好的自我
遇见更好的自我 2021-02-04 22:53

Inspired by \"Getting the source directory of a Bash script from within\", what\'s the Ruby way to do this?

4条回答
  •  无人及你
    2021-02-04 23:53

    ENV["PWD"] seems the simplest way for me under Linux. I don't know of an OS-agnostic way.

提交回复
热议问题