Is there a way to check if there are any new classes or any existing
classes that have changed in the lib/ folder?, and if there are then to
reload them into Rails?
My application is a simply a parsing application that parses multiple
types of formatted documents. New parsers are added regularly and It
would be best for me if i could just drop another parser into the lib/
folder and have it included in the system, without having to restart the
rails application.
I already have a method that scans for Parsing classes to use:
parsers = []
ObjectSpace.each_object(Class) do |klass|
if klass.superclass==Parser &&
klass.methods.include?(“is_compatible?”) &&
klass.instance_methods.include?(“parse”)
parsers << klass
end
end
So basically, i need a scanner that will check every so often to see if
any new parsers have been added or any existing parsers changed, and if
so, then load them!!
Any help is appreciated,
Thanks
Chris