Class: Cubism::Broadcaster
- Inherits:
-
Object
- Object
- Cubism::Broadcaster
- Includes:
- CableReady::Broadcaster, CableReady::StreamIdentifier
- Defined in:
- lib/cubism/broadcaster.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
- #broadcast ⇒ Object
-
#initialize(resource:) ⇒ Broadcaster
constructor
A new instance of Broadcaster.
Constructor Details
#initialize(resource:) ⇒ Broadcaster
Returns a new instance of Broadcaster.
10 11 12 |
# File 'lib/cubism/broadcaster.rb', line 10 def initialize(resource:) @resource = resource end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
8 9 10 |
# File 'lib/cubism/broadcaster.rb', line 8 def resource @resource end |
Instance Method Details
#broadcast ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cubism/broadcaster.rb', line 14 def broadcast resource.cubicle_element_ids.to_a.each do |element_id| block_container = Cubism.block_store[element_id] next if block_container.blank? present_users = resource.present_users_for_element_id_and_scope(element_id, block_container.scope) block_source = block_container.block_source html = ApplicationController.render(inline: block_source.source, locals: {"#{block_source.variable_name}": present_users}) selector = "cubicle-element#cubicle-#{element_id}[identifier='#{signed_stream_identifier(resource.to_global_id.to_s)}']" cable_ready[element_id].inner_html( selector: selector, html: html ) end cable_ready.broadcast end |