What is __FILE__ in Ruby?
While reading open source Ruby code, I often come across this mysterious looking __FILE__ variable (among others) that I never bothered to look into. After coming across it umpteenth time this evening, I decided to read up on it and here's everything I learned.__FILE__ is a magic variable that contains the filename with extension of the current file that's being executed. For example, if you're running code in a file named main.rb, __FILE__ will return "main.rb".
What is __FILE__ in Ruby? #ruby #rubydeveloper #rubyonrails