Last active
August 29, 2015 14:14
-
-
Save launchkit-codes/6b9488196e9db36f422f to your computer and use it in GitHub Desktop.
Understand `require_relative`
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
| # require_relative : | |
| # | |
| # Ruby tries to load the library named string relative to the requiring file’s path. | |
| # If the file’s path cannot be determined a LoadError is raised. | |
| # If a file is loaded true is returned and false otherwise. | |
| # | |
| # Tree directory: | |
| # | |
| # ./ | |
| # |- test | |
| # |- test_helper.rb | |
| # |- data | |
| # |- clients.rb | |
| # | |
| # In ./test/test_helper.rb | |
| require_relative 'data/clients' # ~= require "FILE_PATH/data/clients" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment