I see this all the time in Ruby:
require File.dirname(__FILE__) + '/../../config/environment'
What does __FILE__ mean?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is a reference to the current file name. In the file
foo.rb,__FILE__would be interpreted as'foo.rb'.Edit: Ruby 1.9.2 and 1.9.3 appear to behave a little differently from what Luke Bayes said in his comment. With these files:
Running
ruby test.rbwill output