Created
March 19, 2012 02:53
-
-
Save Rafe/2091941 to your computer and use it in GitHub Desktop.
Ruby LOADPATH cheatsheet
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
#loadfile: | |
$: | |
$LOAD_PATH | |
require File.join(File.dirname(__FILE__), "foo", "bar") #=> "file/foo/bar" | |
#or | |
require File.expand_path(File.join(File.dirname(__FILE__), "foo", "bar")) | |
#=> "path/to/file/foo/bar" | |
require "foo/bar" #=> relative to loadpath, do this in relative files | |
#ruby treat 3 require differently, might over load | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment