Class: Omnes::Subscriber::Adapter::ActiveJob::Instance Private

Inherits:
Object
  • Object
show all
Defined in:
lib/omnes/subscriber/adapter/active_job.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(serializer:) ⇒ Instance

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Instance.



63
64
65
# File 'lib/omnes/subscriber/adapter/active_job.rb', line 63

def initialize(serializer:)
  @serializer = serializer
end

Instance Attribute Details

#serializerObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



61
62
63
# File 'lib/omnes/subscriber/adapter/active_job.rb', line 61

def serializer
  @serializer
end

Instance Method Details

#call(instance, event, publication_context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



67
68
69
70
71
72
73
# File 'lib/omnes/subscriber/adapter/active_job.rb', line 67

def call(instance, event, publication_context)
  if Subscription.takes_publication_context?(instance.method(:perform))
    instance.class.perform_later(serializer.(event), publication_context.serialized)
  else
    instance.class.perform_later(serializer.(event))
  end
end