There are a lot of threads on here about this already I know but none of the titles have this worded exactly like I did. I hope that we can clear this up a bit.
$:.unshift(File.expand_path("../../lib", __FILE__))
You see something like this in a lot of Ruby code. Opinions vary whether this is proper or not.
Can we get a little explaination for each of its parts? There realy is a lot going on here. I only understand some of it.
$:
holds Load path for scripts and binary modules by load or require. . And Array#unshift
will prepend the new path to $:
. File#expand_path
Converts a pathname to an absolute pathname. __FILE__
is already answered here What does __FILE__ mean in Ruby?
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With