Class: Upkeep::Delivery::TurboStreams::Envelope
- Inherits:
-
Data
- Object
- Data
- Upkeep::Delivery::TurboStreams::Envelope
- Defined in:
- lib/upkeep/delivery/turbo_streams.rb
Instance Attribute Summary collapse
-
#stream_name ⇒ Object
readonly
Returns the value of attribute stream_name.
-
#streams ⇒ Object
readonly
Returns the value of attribute streams.
-
#subscriber_id ⇒ Object
readonly
Returns the value of attribute subscriber_id.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#stream_name ⇒ Object (readonly)
Returns the value of attribute stream_name
53 54 55 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 53 def stream_name @stream_name end |
#streams ⇒ Object (readonly)
Returns the value of attribute streams
53 54 55 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 53 def streams @streams end |
#subscriber_id ⇒ Object (readonly)
Returns the value of attribute subscriber_id
53 54 55 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 53 def subscriber_id @subscriber_id end |
Class Method Details
.shared(stream_name, streams) ⇒ Object
58 59 60 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 58 def self.shared(stream_name, streams) new("shared:#{stream_name}", streams, stream_name) end |
.subscriber(subscriber_id, streams) ⇒ Object
54 55 56 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 54 def self.subscriber(subscriber_id, streams) new(subscriber_id, streams, nil) end |
Instance Method Details
#body ⇒ Object
62 63 64 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 62 def body streams.map(&:to_html).join("\n") end |
#report ⇒ Object
66 67 68 69 70 71 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 66 def report { subscriber_id: subscriber_id, streams: streams.map(&:report) } end |