Skip to content

Instantly share code, notes, and snippets.

@Rafe
Created March 19, 2012 02:53
Show Gist options
  • Save Rafe/2091941 to your computer and use it in GitHub Desktop.
Save Rafe/2091941 to your computer and use it in GitHub Desktop.
Ruby LOADPATH cheatsheet
#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