You don't need to pack everything inside a begin
once again. This works in the same manner:
module MyModule
class MyClass
def do_something
deployer_object = Object.const_get("MyModule").const_get("#{class_name}Deployer").new(@config, @directory).deploy
rescue NameError => e
MyModule::Logger.error("Error loading the deployer #{class_name}. This deployer it's not installed!")
end
end
end
I don't fully understand your question. What are you trying to rescue from? You don't want to catch exceptions from Deployer's
initializer?