Sha256: ac0d5b0dbe45e43d0a55003f2270c61f360c995df7219bcfb5e17363c66df204
Contents?: true
Size: 910 Bytes
Versions: 1
Compression:
Stored size: 910 Bytes
Contents
require "cable_ready" module Cubism class Broadcaster include CableReady::Broadcaster include CableReady::StreamIdentifier attr_reader :resource def initialize(resource:) @resource = resource end def broadcast resource.cubicle_element_ids.to_a.each do |element_id| /cubicle-(?<block_key>.+)/ =~ element_id block_container = Cubism.block_store[block_key] next if block_container.blank? block_source = block_container.block_source html = ApplicationController.render(inline: block_source.source, locals: {"#{block_source.variable_name}": resource.present_users_for_element_id(element_id)}) cable_ready[element_id].inner_html( selector: "cubicle-element##{element_id}[identifier='#{signed_stream_identifier(resource.to_global_id.to_s)}']", html: html ).broadcast end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cubism-0.1.0.pre11 | lib/cubism/broadcaster.rb |