Skip to content

Instantly share code, notes, and snippets.

@taiar
Last active March 29, 2020 17:26
Show Gist options
  • Save taiar/cadf7e31094528ffa2f326894be56401 to your computer and use it in GitHub Desktop.
Save taiar/cadf7e31094528ffa2f326894be56401 to your computer and use it in GitHub Desktop.
Get list of new queues that might be created
[
'/home/taiar/***/app/workers/',
'/home/taiar/***/app/workers/accounts/',
'/home/taiar/***/app/workers/cards/',
'/home/taiar/***/app/workers/consumers/'
].each do |path|
files = Dir.glob("#{path}*").collect { |file_path| File.basename(file_path) }
files.select! { | f | File.extname(f) == '.rb' }
files.each { | e | require "#{path}#{e}" }
end
classes = ObjectSpace.each_object(Class).select { |c| c.included_modules.include? SelectQueueConcern }
queues = classes.map { |c| c.to_s.underscore.tr '/', '_' }
puts queues.inspect
puts queues.size
# ✗ r r -e development check_class_with_module.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment