Skip to content

Instantly share code, notes, and snippets.

@mbbx6spp
Created November 2, 2016 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbbx6spp/7741ce8c4ab0b2c7aac74cf0854cfb47 to your computer and use it in GitHub Desktop.
Save mbbx6spp/7741ce8c4ab0b2c7aac74cf0854cfb47 to your computer and use it in GitHub Desktop.
Demonstrate difference between load and require in Ruby
[nix-shell:~/src]$ cat x.rb y.rb crap.rb
# x.rb
load 'crap.rb'
load 'crap.rb'
# y.rb
require 'crap.rb'
require 'crap.rb'
# crap.rb
puts 'hi'

[nix-shell:~/src]$ ruby x.rb
hi
hi

[nix-shell:~/src]$ ruby y.rb
hi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment