Skip to content

Instantly share code, notes, and snippets.

@mkurtikov
Created April 14, 2016 11:16
Show Gist options
  • Save mkurtikov/3d89b395b2c8772b0d5b1d1ccbb5265b to your computer and use it in GitHub Desktop.
Save mkurtikov/3d89b395b2c8772b0d5b1d1ccbb5265b to your computer and use it in GitHub Desktop.
Ruby require
## 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