U
Une Bévue
i have a script in my HOME/bin :
/Users/yt/bin/path_test.rb
my "HOME/bin" is in the PATH
then, if from this script, i outputs $0 and __FILE__
with :
path_test.rb i got :
$0 = /Users/yt/bin/path_test.rb
__FILE__ = /Users/yt/bin/path_test.rb
and the same outputs with :
/Users/yt/bin/path_test.rb
why do i have the same outputs in this case ?
in fact i'm looking that because i do have Ruby class extension in a
subfolder of "HOME/bin", namely :
HOME/bin/ruby_ext
where i put my extension for classes of which i could require :
require "#{File.dirname($0)}/ruby_ext/ansi_color"
what's the best way to require in that case, does i need an "absolute
path (starting from / ) or not ?
/Users/yt/bin/path_test.rb
my "HOME/bin" is in the PATH
then, if from this script, i outputs $0 and __FILE__
with :
path_test.rb i got :
$0 = /Users/yt/bin/path_test.rb
__FILE__ = /Users/yt/bin/path_test.rb
and the same outputs with :
/Users/yt/bin/path_test.rb
why do i have the same outputs in this case ?
in fact i'm looking that because i do have Ruby class extension in a
subfolder of "HOME/bin", namely :
HOME/bin/ruby_ext
where i put my extension for classes of which i could require :
require "#{File.dirname($0)}/ruby_ext/ansi_color"
what's the best way to require in that case, does i need an "absolute
path (starting from / ) or not ?