Skip to content

Instantly share code, notes, and snippets.

@fgarcia
Created October 29, 2014 08:04
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 fgarcia/3d6acefb1f3936105ebb to your computer and use it in GitHub Desktop.
Save fgarcia/3d6acefb1f3936105ebb to your computer and use it in GitHub Desktop.
Test if file extension matters in Ruby 'require'
require './b'
require './b.rb'
puts "I was required"
@fgarcia
Copy link
Author

fgarcia commented Oct 29, 2014

As of Ruby 2.1.3, executing ruby a.rb prints the message only once, so it looks like require can recognize that both lines refrence the same file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment