$:.unshift File.expand_path(path, __FILE__)
I saw this line of code somewhere and i felt kind of confuse about it and intimidate. That's why, i'll try to explain what i've found so far (if there is any errors, feel free to point them out).
$:
?
What is this This alien thing $:
is a shortcut referencing the $LOAD_PATH
. What is the $LOAD_PATH
?
The $LOAD_PATH
is a global variable as you can tell from $
at the beginning. A global variable is a variable which
is accessible from everywhere in a given context. For example take a look at the function below :