Created
April 14, 2016 11:16
-
-
Save mkurtikov/3d89b395b2c8772b0d5b1d1ccbb5265b to your computer and use it in GitHub Desktop.
Ruby require
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
| ## http://ruby-doc.org/core-2.1.2/Kernel.html | |
| # /Users/tmp/a.rb | |
| p 'Hello' | |
| class A | |
| def hello | |
| p 'Hello' | |
| end | |
| end | |
| #### | |
| load '/Users/tmp/a' # oadError: cannot load such file -- /Users/tmp/a | |
| load '/Users/tmp/a.rb' | |
| # "Hello" | |
| # true | |
| load '/Users/tmp/a.rb' | |
| # "Hello" | |
| # true | |
| require '/Users/tmp/a' | |
| # "Hello" | |
| # true | |
| require '/Users/tmp/a' # false | |
| require '/Users/tmp/a.rb' # false | |
| require_relative 'a.rb' # true | |
| require_relative 'a.rb' # LoadError: cannot infer basepath from irb | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment