Module: Motion::Component::Broadcasts

Extended by:
ActiveSupport::Concern
Includes:
ModuleFunctions
Included in:
Motion::Component
Defined in:
lib/motion/component/broadcasts.rb

Defined Under Namespace

Modules: ModuleFunctions

Instance Method Summary collapse

Methods included from ModuleFunctions

#broadcasts, #stop_streaming_for, #stop_streaming_from, #stream_for, #stream_from

Instance Method Details

#process_broadcast(broadcast, message) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
# File 'lib/motion/component/broadcasts.rb', line 78

def process_broadcast(broadcast, message)
  return unless (handler = _broadcast_handlers[broadcast])

  _run_action_callbacks(context: handler) do
    if method(handler).arity.zero?
      send(handler)
    else
      send(handler, message)
    end
  end
end