Sha256: 4bc2ecd81de25f8896737caad2c08ec65596f851167a26e200cee2130bfd7d90
Contents?: true
Size: 901 Bytes
Versions: 13
Compression:
Stored size: 901 Bytes
Contents
module Futurism class Channel < ActionCable::Channel::Base include CableReady::Broadcaster def stream_name ids = connection.identifiers.map { |identifier| send(identifier).try(:id) || send(identifier) } [ params[:channel], ids.select(&:present?).join(";") ].select(&:present?).join(":") end def subscribed stream_from stream_name end def receive(data) resources = data.fetch_values("signed_params", "sgids", "signed_controllers", "urls") { |_key| Array.new(data["signed_params"].length, nil) }.transpose resolver = Resolver::Resources.new(resource_definitions: resources, connection: connection, params: @params) resolver.resolve do |selector, html| cable_ready[stream_name].outer_html( selector: selector, html: html ) end cable_ready.broadcast end end end
Version data entries
13 entries across 13 versions & 1 rubygems