I was reading a gemspec file and the directory looks like
gem/
lib/
a.rb
gem.gemspec
In the gemspec there is a line
$:.push File.expand_path('../lib', __FILE__)
I suppose it means adding the lib
folder to Ruby's load path so in there you can require
stuff.
But why ../lib
not simply lib
?
Using the same example as above, if you want to load the code in a.rb
, don't you just do require 'a'
instead of require '../a'
?
Notice both lib
and a.rb
have the same relative position from gemspec
.