Class: Dato::LiveStream
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Dato::LiveStream
- Defined in:
- app/components/dato/live_stream.rb
Instance Attribute Summary collapse
-
#component_klass ⇒ Object
readonly
Returns the value of attribute component_klass.
-
#preview ⇒ Object
readonly
Returns the value of attribute preview.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #data ⇒ Object
- #frame_id ⇒ Object
-
#initialize(component_klass, query, preview: false) ⇒ LiveStream
constructor
A new instance of LiveStream.
Constructor Details
#initialize(component_klass, query, preview: false) ⇒ LiveStream
Returns a new instance of LiveStream.
12 13 14 15 16 17 |
# File 'app/components/dato/live_stream.rb', line 12 def initialize(component_klass, query, preview: false) super() @component_klass = component_klass @query = query @preview = preview end |
Instance Attribute Details
#component_klass ⇒ Object (readonly)
Returns the value of attribute component_klass.
10 11 12 |
# File 'app/components/dato/live_stream.rb', line 10 def component_klass @component_klass end |
#preview ⇒ Object (readonly)
Returns the value of attribute preview.
10 11 12 |
# File 'app/components/dato/live_stream.rb', line 10 def preview @preview end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
10 11 12 |
# File 'app/components/dato/live_stream.rb', line 10 def query @query end |
Instance Method Details
#data ⇒ Object
19 20 21 |
# File 'app/components/dato/live_stream.rb', line 19 def data @data ||= dato_fetch(query, preview: preview) end |
#frame_id ⇒ Object
23 24 25 |
# File 'app/components/dato/live_stream.rb', line 23 def frame_id @frame_id ||= SecureRandom.hex(10) end |