Class: Upkeep::Delivery::TurboStreams::Batch
- Inherits:
-
Data
- Object
- Data
- Upkeep::Delivery::TurboStreams::Batch
- Defined in:
- lib/upkeep/delivery/turbo_streams.rb
Instance Attribute Summary collapse
-
#streams ⇒ Object
readonly
Returns the value of attribute streams.
Instance Method Summary collapse
Instance Attribute Details
#streams ⇒ Object (readonly)
Returns the value of attribute streams
74 75 76 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 74 def streams @streams end |
Instance Method Details
#envelope_for(subscriber_id) ⇒ Object
84 85 86 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 84 def envelope_for(subscriber_id) Envelope.subscriber(subscriber_id, streams.select { |stream| stream.for_subscriber?(subscriber_id) }) end |
#envelopes ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 75 def envelopes return [] if streams.empty? direct_subscriber_id = single_direct_subscriber_id return [Envelope.subscriber(direct_subscriber_id, streams)] if direct_subscriber_id shared_envelopes + subscriber_envelopes end |
#report ⇒ Object
88 89 90 91 92 93 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 88 def report { streams: streams.map(&:report), envelopes: envelopes.map(&:report) } end |