Skip to content

Instantly share code, notes, and snippets.

@woods
Created August 14, 2015 02:28
Show Gist options
  • Save woods/9440b2ca3dd5d2cc9cd7 to your computer and use it in GitHub Desktop.
Save woods/9440b2ca3dd5d2cc9cd7 to your computer and use it in GitHub Desktop.
$ echo 'puts "hi"' > hello.rb
$ irb
irb(main):001:0> require 'hello'
LoadError: cannot load such file -- hello
from /Users/woods/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/woods/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from (irb):1
from /Users/woods/.rbenv/versions/2.2.2/bin/irb:11:in `<main>'
irb(main):002:0> require_relative './hello'
hi
=> true
irb(main):003:0> require_relative './hello'
=> false
irb(main):004:0> load 'hello'
LoadError: cannot load such file -- hello
from (irb):4:in `load'
from (irb):4
from /Users/woods/.rbenv/versions/2.2.2/bin/irb:11:in `<main>'
irb(main):005:0> load './hello'
LoadError: cannot load such file -- ./hello
from (irb):5:in `load'
from (irb):5
from /Users/woods/.rbenv/versions/2.2.2/bin/irb:11:in `<main>'
irb(main):006:0> load 'hello.rb'
hi
=> true
irb(main):007:0> load 'hello.rb'
hi
=> true
irb(main):008:0> load 'hello.rb'
hi
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment