The -rubygems Flag
I was always slightly confused that despite rubygems not being part of the ruby language or interpreter, there is nonetheless a -rubygems
option you can give to ruby to enable rubygems.
Today when I was delving through some stack traces, I noticed an odd looking filename at the root of it all. As I’m sure many before me have realised (a bunch of my workmates already knew about this), the -rubygems
flag is not a real flag at all. It’s just a perverted case of the -r module
syntax which tells ruby to require a file by name. Because when you install rubygems, it conveniently installs a file called ubygems.rb
whose contents is simply require "rubygems"
. Very sneaky…