From: James Byrne Date: 2010-09-08T01:59:01+09:00 Subject: [ruby-core:32108] [Ruby 1.9.2-Backport#3799][Open] Unexpected behaviour of require_relative Backport #3799: Unexpected behaviour of require_relative http://redmine.ruby-lang.org/issues/show/3799 Author: James Byrne Status: Open, Priority: Normal I have this code written to handle ruby 1.8 and 1.9.2: #!/usr/bin/env ruby
library = '/../lib/forex/hll_forex_ca_feed'

if RUBY_VERSION < '1.9.2'
  require File.dirname(__FILE__) + library
else
  require_relative File.dirname(__FILE__) + '/..' + library
end

HLLForexCAFeed::Main.new(ARGV).execute
This code works with 1.8.6+ and 1.9.2. However, please note the insertion of an additional directory reverse traversal. If I do not provide this to Ruby-1.9.2 then the require fails with this error:
$ bin/forex
bin/forex:8:in `require_relative': no such file to load -- /home/byrnejb/Software/Development/Projects/proforma.git/bin/lib/forex/hll_forex_ca_feed (LoadError)
        from bin/forex:8:in `
My question is: Why does Ruby-1.9.2-p0 require the additional backtrack? ---------------------------------------- http://redmine.ruby-lang.org