Module: ActionCable::Channel::Broadcasting::ClassMethods
- Defined in:
- lib/action_cable/channel/broadcasting.rb
Instance Method Summary collapse
-
#broadcast_to(model, message) ⇒ Object
Broadcast a hash to a unique broadcasting for this
model
in this channel. -
#broadcasting_for(model) ⇒ Object
:nodoc:.
Instance Method Details
#broadcast_to(model, message) ⇒ Object
Broadcast a hash to a unique broadcasting for this model
in this channel.
14 15 16 |
# File 'lib/action_cable/channel/broadcasting.rb', line 14 def broadcast_to(model, ) ActionCable.server.broadcast(broadcasting_for([ channel_name, model ]), ) end |
#broadcasting_for(model) ⇒ Object
:nodoc:
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/action_cable/channel/broadcasting.rb', line 18 def broadcasting_for(model) #:nodoc: case when model.is_a?(Array) model.map { |m| broadcasting_for(m) }.join(":") when model.respond_to?(:to_gid_param) model.to_gid_param else model.to_param end end |