require ‘rubygems’ => false

The value returned by require doesn’t tell whether there was an error or not (if the file can’t be found, a LoadError exception will be raised).

since require tries to avoid loading a file more than one time, it says whether you required the file for the first time (true) or if it had already been loaded (in this case returns false and doesn’t try to load the file again). So, the fact that in irb

require ‘rubygems’

returns false only means that the file rubygems.rb had already been loaded,
and it wasn’t necessary to load it a second time.

~$ irb
irb(main):001:0> require 'time'
=> true
irb(main):002:0> require 'time'
=> false

Leave a Reply

Your email address will not be published. Required fields are marked *

*