Skip to content
Snippets Groups Projects
Commit f09999de authored by John Harris's avatar John Harris
Browse files

style: address RedundantBegin

parent b45f3b3c
No related branches found
No related tags found
1 merge request!7Resolve "autoregister cqrs handlers fails to handle sub dirs"
Pipeline #20921 passed
......@@ -10,12 +10,10 @@ module NexusCqrs
def autoregister(base_class, dir = 'app/domain/commands')
# Iterate over the directory passed and find all ruby files, removing unwanted parts of the string.
Dir["#{dir}/**/*.rb"].each do |file|
begin
# Constantize class name to constant to force rails to autoload this class
File.basename(file, ".rb").camelize.constantize
rescue NameError => e
Rails.logger.warn { "Failed autoregister #{file.camelize}, received NameError: #{e}" }
end
# Constantize class name to constant to force rails to autoload this class
File.basename(file, ".rb").camelize.constantize
rescue NameError => e
Rails.logger.warn { "Failed autoregister #{file.camelize}, received NameError: #{e}" }
end
ObjectSpace.each_object(Class).select { |klass| klass < base_class }.each do |c|
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment