Class: Upkeep::Delivery::TurboStreams::Stream
- Inherits:
-
Data
- Object
- Data
- Upkeep::Delivery::TurboStreams::Stream
- Defined in:
- lib/upkeep/delivery/turbo_streams.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#deoptimization_reason ⇒ Object
readonly
Returns the value of attribute deoptimization_reason.
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#html_digest ⇒ Object
readonly
Returns the value of attribute html_digest.
-
#identity_signature ⇒ Object
readonly
Returns the value of attribute identity_signature.
-
#matched_dependency_keys ⇒ Object
readonly
Returns the value of attribute matched_dependency_keys.
-
#render_duration_ms ⇒ Object
readonly
Returns the value of attribute render_duration_ms.
-
#shared_stream_name ⇒ Object
readonly
Returns the value of attribute shared_stream_name.
-
#subscriber_ids ⇒ Object
readonly
Returns the value of attribute subscriber_ids.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#target_selector ⇒ Object
readonly
Returns the value of attribute target_selector.
Instance Method Summary collapse
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def action @action end |
#deoptimization_reason ⇒ Object (readonly)
Returns the value of attribute deoptimization_reason
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def deoptimization_reason @deoptimization_reason end |
#html ⇒ Object (readonly)
Returns the value of attribute html
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def html @html end |
#html_digest ⇒ Object (readonly)
Returns the value of attribute html_digest
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def html_digest @html_digest end |
#identity_signature ⇒ Object (readonly)
Returns the value of attribute identity_signature
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def identity_signature @identity_signature end |
#matched_dependency_keys ⇒ Object (readonly)
Returns the value of attribute matched_dependency_keys
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def matched_dependency_keys @matched_dependency_keys end |
#render_duration_ms ⇒ Object (readonly)
Returns the value of attribute render_duration_ms
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def render_duration_ms @render_duration_ms end |
#shared_stream_name ⇒ Object (readonly)
Returns the value of attribute shared_stream_name
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def shared_stream_name @shared_stream_name end |
#subscriber_ids ⇒ Object (readonly)
Returns the value of attribute subscriber_ids
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def subscriber_ids @subscriber_ids end |
#target ⇒ Object (readonly)
Returns the value of attribute target
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def target @target end |
#target_selector ⇒ Object (readonly)
Returns the value of attribute target_selector
9 10 11 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 9 def target_selector @target_selector end |
Instance Method Details
#for_subscriber?(subscriber_id) ⇒ Boolean
33 34 35 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 33 def for_subscriber?(subscriber_id) subscriber_ids.include?(subscriber_id) end |
#rendered? ⇒ Boolean
29 30 31 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 29 def rendered? action != "remove" end |
#report ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 37 def report { action: action, target: target.to_h, target_selector: target_selector, identity_signature: identity_signature, shared_stream_name: shared_stream_name, html_digest: html_digest, subscriber_ids: subscriber_ids, matched_dependency_keys: matched_dependency_keys, deoptimization_reason: deoptimization_reason, render_duration_ms: render_duration_ms } end |
#to_html ⇒ Object
22 23 24 25 26 27 |
# File 'lib/upkeep/delivery/turbo_streams.rb', line 22 def to_html attributes = %(action="#{CGI.escapeHTML(action)}" targets="#{CGI.escapeHTML(target_selector)}") return %(<turbo-stream #{attributes}></turbo-stream>) if action == "remove" %(<turbo-stream #{attributes}><template>#{html}</template></turbo-stream>) end |