Class: Amigo::Router
- Inherits:
-
Object
- Object
- Amigo::Router
- Includes:
- Sidekiq::Worker
- Defined in:
- lib/amigo/router.rb
Instance Method Summary collapse
Instance Method Details
#perform(event_json) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/amigo/router.rb', line 11 def perform(event_json) event_name = event_json["name"] matches = Amigo.registered_event_jobs. select do |job| if job.pattern.is_a?(Regexp) job.pattern.match(event_name) else File.fnmatch(job.pattern, event_name, File::FNM_EXTGLOB) end end matches.each do |job| Amigo.synchronous_mode ? job.new.perform(event_json) : job.perform_async(event_json) end end |