Module: Pgbus::Streams::BroadcastableOverride::ClassMethods
- Defined in:
- lib/pgbus/streams/broadcastable_override.rb
Instance Method Summary collapse
- #broadcasts_refreshes_to(stream, durable: nil) ⇒ Object
- #broadcasts_to(stream, durable: nil, inserts_by: :append, target: broadcast_target_default, **rendering) ⇒ Object
- #pgbus_durable_streams ⇒ Object
Instance Method Details
#broadcasts_refreshes_to(stream, durable: nil) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/pgbus/streams/broadcastable_override.rb', line 94 def broadcasts_refreshes_to(stream, durable: nil) if durable.nil? after_commit -> { broadcast_refresh_later_to(stream.try(:call, self) || send(stream)) } else @pgbus_durable_streams ||= {} @pgbus_durable_streams[stream] = durable after_commit lambda { broadcast_refresh_to(stream.try(:call, self) || send(stream), durable: durable) } end end |
#broadcasts_to(stream, durable: nil, inserts_by: :append, target: broadcast_target_default, **rendering) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/pgbus/streams/broadcastable_override.rb', line 60 def broadcasts_to(stream, durable: nil, inserts_by: :append, target: broadcast_target_default, **rendering) if durable.nil? after_create_commit lambda { broadcast_action_later_to( stream.try(:call, self) || send(stream), action: inserts_by, target: target.try(:call, self) || target, **rendering ) } after_update_commit -> { broadcast_replace_later_to(stream.try(:call, self) || send(stream), **rendering) } after_destroy_commit -> { broadcast_remove_to(stream.try(:call, self) || send(stream)) } else @pgbus_durable_streams ||= {} @pgbus_durable_streams[stream] = durable after_create_commit lambda { broadcast_action_to( stream.try(:call, self) || send(stream), action: inserts_by, target: target.try(:call, self) || target, durable: durable, **rendering ) } after_update_commit lambda { broadcast_replace_to(stream.try(:call, self) || send(stream), durable: durable, **rendering) } after_destroy_commit lambda { broadcast_remove_to(stream.try(:call, self) || send(stream), durable: durable) } end end |
#pgbus_durable_streams ⇒ Object
107 108 109 |
# File 'lib/pgbus/streams/broadcastable_override.rb', line 107 def pgbus_durable_streams @pgbus_durable_streams || {} end |