Created
April 3, 2015 20:48
-
-
Save mmasashi/66691e0cdfe4df88371e to your computer and use it in GitHub Desktop.
Append a new load path to the head of $LOAD_PATH if not exists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def append_load_path_if_not_exist(new_lib_path) | |
| absolute_path = File.realpath(new_lib_path) | |
| $LOAD_PATH.unshift absolute_path unless $LOAD_PATH.include? absolute_path | |
| end | |
| another_lib_dir = File.realpath('../../lib', __FILE__) | |
| append_load_path_if_not_exist(another_lib_dir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment