Project

General

Profile

Actions

Bug #9244

closed

unexpected behaviour of 'require' when $LOAD_PATH gets changed

Added by sylvain.joyeux (Sylvain Joyeux) over 10 years ago. Updated over 7 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
1.9.3p484, 2.0.0p353, 2.1.2 2.1.6p336 2.2.1p85 2.3.1p112
Backport:
[ruby-core:59069]

Description

For the purpose of reproducing the error, let's assume that I have two folders a and b which both contain a file test.rb

In the following script, b/test.rb will NOT get loaded:

 $LOAD_PATH.unshift File.join(Dir.pwd, 'a')
 require 'test.rb'
 $LOAD_PATH.unshift File.join(Dir.pwd, 'b')
 require 'test.rb'

I would have expected this behaviour before, when required files were not registered through their absolute paths in $LOADED_FEATURES. Right now, I find it confusing.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0