Ruby: require vs require_relative - best practice to workaround running in both Ruby <1.9.2 and >=1.9.2
问题 What is the best practice if I want to require a relative file in Ruby and I want it to work in both 1.8.x and >=1.9.2? I see a few options: just do $LOAD_PATH << \'.\' and forget everything do $LOAD_PATH << File.dirname(__FILE__) require \'./path/to/file\' check if RUBY_VERSION < 1.9.2, then define require_relative as require , use require_relative everywhere where it\'s needed afterwards check if require_relative already exists, if it does, try to proceed as in previous case use weird