Class: Wisper::ActiveJobBroadcaster::Wrapper
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- Wisper::ActiveJobBroadcaster::Wrapper
- Defined in:
- lib/wisper_plus.rb
Instance Method Summary collapse
Instance Method Details
#perform(class_name, event, args) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/wisper_plus.rb', line 61 def perform(class_name, event, args) listener = class_name.constantize.new if listener.respond_to?(event) args = JSON.parse(args).map do |e| if e.is_a?(String) && e.starts_with?("gid://") begin GlobalID::Locator.locate(e) rescue ActiveRecord::RecordNotFound listener = nil end else e end end listener&.public_send(event, *args) end end |