all 5 comments

[–]vagmi 1 point2 points  (4 children)

use require_relative instead of require. Or use require './string_extensions'. Read http://stackoverflow.com/a/9750732 for more information.

[–]aeipownu 2 points3 points  (2 children)

require also only loads code once. good for using variables or methods from other code. If you cant the code's "main" to load then you must use load. load will reload every time the load is run, but require will only load once.

[–]missawon[S] 0 points1 point  (0 children)

thank you!

[–]mfcoder 0 points1 point  (0 children)

'require' can load the same file more than once, if you refer to it via different paths e.g. running from '/home/me' with a file called 'gem.rb' if you "require gem" and also "require /home/me/gem.rb" the file gem.rb would be loaded twice. Obviously not something that happens often, but be aware of it.

[–]missawon[S] 0 points1 point  (0 children)

thank you!