Module: Motion::ActionCableExtentions::Synchronization

Included in:
DeclarativeNotifications, DeclarativeStreams
Defined in:
lib/motion/action_cable_extentions/synchronization.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



8
9
10
11
12
# File 'lib/motion/action_cable_extentions/synchronization.rb', line 8

def initialize(*)
  super

  @_monitor = Monitor.new
end

#perform_actionObject



29
30
31
# File 'lib/motion/action_cable_extentions/synchronization.rb', line 29

def perform_action(*)
  synchronize_entrypoint! { super }
end

#subscribe_to_channelObject

Synchronize all standard ActionCable entry points.



21
22
23
# File 'lib/motion/action_cable_extentions/synchronization.rb', line 21

def subscribe_to_channel(*)
  synchronize_entrypoint! { super }
end

#synchronize_entrypoint!(&block) ⇒ Object

Additional entrypoints added by other modules should wrap any entry points that they add with this.



16
17
18
# File 'lib/motion/action_cable_extentions/synchronization.rb', line 16

def synchronize_entrypoint!(&block)
  @_monitor.synchronize(&block)
end

#unsubscribe_from_channelObject



25
26
27
# File 'lib/motion/action_cable_extentions/synchronization.rb', line 25

def unsubscribe_from_channel(*)
  synchronize_entrypoint! { super }
end