ruby : when to use 'load' to load file instead of 'require' -


this question has answer here:

i know basic difference between load , require statement. load loads file multiple time if loaded , require loads file once.

i want know when use load statement on require statement. if possible please explain small example.

thanks,

as know, load re-loads file, if loaded; whereas require loads file once.

as such, should (for performance reasons) use require instead of load.

using load can useful if file changes state - although rare thing happen.

typically, load geared more implementing customized runners ruby code loading classes , modules in projects - example, it's used capistrano. or common use when developing/debugging project open console, can use: load 'filename_i_just_edited' refresh code state, rather re-starting console.


Comments

Popular posts from this blog

ruby on rails - Permission denied @ sys_fail2 - (D:/RoR/projects/grp/public/uploads/ -

c++ - nodejs socket.io closes connection before upgrading to websocket -

java - What is the equivalent of @Value in CDI world? -