What is __FILE__ in Ruby?
09-Feb-2024 981
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 #__FILE__ #Ruby? https://rubyonrails.ba/link/what-is-__file__-in-ruby