I understand the subtle differences between require
, load
and autoload
in Ruby, but my question is, how do you know which one to use?
Other than being able to "wrap" a load
in an anonymous module, require
seems to be preferred.
But then autoload
allows you to lazy load files -- which sounds fantastic but I'm not sure practically what you gain over require
Is one method preferred over the other? Is there a situation where one method stands out?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…