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

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -