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?
require
I see a few options:
The backports gem now allows individual loading of backports.
You could then simply:
require 'backports/1.9.1/kernel/require_relative' # => Now require_relative works for all versions of Ruby
This require will not affect newer versions, nor will it update any other builtin methods.