The situation
The general idea is this: in the create
method (in the controller) depending on a parameter, I have to run one of three methods as following:
case a
when 1..5
runMethod1(a)
when 6
runMethod2
when String
runMethod3(a)
else
puts "I have no idea what to do with that."
end
These methods are also defined in the same controller. Now, each method calls a particular library by using require
. Those libraries aren't gems, they are files coded by me and located in the framework /lib
path.
def runMethod1(a)
require 'my_first_library'
...
end
What I am trying to do here is calling the library only when I need it, because each method might have an important processing and/or memory load on the system and I don't want to call all the libraries at the beginnig because I don't know if they all are gonna be used.
The Question
I'd like to know if Rails takes care of unloading this libraries when the method has finished or if it keeps it after the first call.