Class: Omnes::Subscriber::Adapter::Sidekiq::Instance Private
- Inherits:
-
Object
- Object
- Omnes::Subscriber::Adapter::Sidekiq::Instance
- Defined in:
- lib/omnes/subscriber/adapter/sidekiq.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
- #serializer ⇒ Object readonly private
Instance Method Summary collapse
- #call(instance, event, publication_context) ⇒ Object private
- #in(seconds) ⇒ Object private
-
#initialize(serializer:) ⇒ Instance
constructor
private
A new instance of Instance.
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.
75 76 77 |
# File 'lib/omnes/subscriber/adapter/sidekiq.rb', line 75 def initialize(serializer:) @serializer = serializer end |
Instance Attribute Details
#serializer ⇒ Object (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.
73 74 75 |
# File 'lib/omnes/subscriber/adapter/sidekiq.rb', line 73 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.
79 80 81 82 83 84 85 |
# File 'lib/omnes/subscriber/adapter/sidekiq.rb', line 79 def call(instance, event, publication_context) if takes_publication_context?(instance) instance.class.perform_async(serializer.(event), publication_context.serialized) else instance.class.perform_async(serializer.(event)) end end |
#in(seconds) ⇒ 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.
87 88 89 90 91 92 93 94 95 |
# File 'lib/omnes/subscriber/adapter/sidekiq.rb', line 87 def in(seconds) lambda do |instance, event, publication_context| if takes_publication_context?(instance) instance.class.perform_in(seconds, serializer.(event), publication_context.serialized) else instance.class.perform_in(seconds, serializer.(event)) end end end |