class Motion::Callback

Constants

NAMESPACE

Attributes

broadcast[R]

Public Class Methods

broadcast_for(component, method) click to toggle source
# File lib/motion/callback.rb, line 12
def self.broadcast_for(component, method)
  [
    NAMESPACE,
    component.stable_instance_identifier_for_callbacks,
    method
  ].join(":")
end
new(component, method) click to toggle source
# File lib/motion/callback.rb, line 20
def initialize(component, method)
  @broadcast = self.class.broadcast_for(component, method)

  component.stream_from(broadcast, method)
end

Public Instance Methods

==(other) click to toggle source
# File lib/motion/callback.rb, line 26
def ==(other)
  other.is_a?(Callback) &&
    other.broadcast == broadcast
end
call(message = nil) click to toggle source
# File lib/motion/callback.rb, line 31
def call(message = nil)
  ActionCable.server.broadcast(broadcast, message)
end