Why is __FILE__ uppercase and __dir__ lowercase?

conradkleinespel picture conradkleinespel · Mar 3, 2013 · Viewed 12.8k times · Source

In Ruby 2.0.0-p0, the __dir__ variable was introduced for easy access to the directory of the file currently being executed.

Why is __dir__ lowercase when __FILE__ is uppercase?

Answer

Intrepidd picture Intrepidd · Mar 3, 2013

I think that is because __FILE__ is a parse-time constant whereas __dir__ is a function and returns File.dirname(File.realpath(__FILE__))

For more details, see This discussion