Method: DiscoApp::WebhookService.find_job_class
- Defined in:
- app/services/disco_app/webhook_service.rb
.find_job_class(topic) ⇒ Object
Try to find a job class for the given webhook topic.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/disco_app/webhook_service.rb', line 16 def self.find_job_class(topic) # First try to find a top-level matching job class. "#{topic}_job".tr('/', '_').classify.constantize rescue NameError # If that fails, try to find a DiscoApp:: prefixed job class. begin %(DiscoApp::#{"#{topic}_job".tr('/', '_').classify}).constantize rescue NameError nil end end |