Class: Dato::LiveStream

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/dato/live_stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_klassObject (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

#previewObject (readonly)

Returns the value of attribute preview.



10
11
12
# File 'app/components/dato/live_stream.rb', line 10

def preview
  @preview
end

#queryObject (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

#dataObject



19
20
21
# File 'app/components/dato/live_stream.rb', line 19

def data
  @data ||= dato_fetch(query, preview: preview)
end

#frame_idObject



23
24
25
# File 'app/components/dato/live_stream.rb', line 23

def frame_id
  @frame_id ||= SecureRandom.hex(10)
end