Module: BroadcastHub::Broadcaster

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/broadcast_hub/broadcaster.rb

Overview

Adds lifecycle-driven Action Cable broadcasting helpers to models.

Instance Method Summary collapse

Instance Method Details

#broadcast_append(target) ⇒ void

This method returns an undefined value.

Broadcasts an append action for the model instance.

Parameters:

  • target (String)

    DOM target for insertion



12
13
14
# File 'app/models/concerns/broadcast_hub/broadcaster.rb', line 12

def broadcast_append(target)
  broadcast_action("append", target)
end

#broadcast_prepend(target) ⇒ void

This method returns an undefined value.

Broadcasts a prepend action for the model instance.

Parameters:

  • target (String)

    DOM target for insertion



20
21
22
# File 'app/models/concerns/broadcast_hub/broadcaster.rb', line 20

def broadcast_prepend(target)
  broadcast_action("prepend", target)
end

#broadcast_remove(target) ⇒ void

This method returns an undefined value.

Broadcasts a remove action for the model instance.

Parameters:

  • target (String)

    DOM target to remove



36
37
38
# File 'app/models/concerns/broadcast_hub/broadcaster.rb', line 36

def broadcast_remove(target)
  broadcast_action("remove", target)
end

#broadcast_update(target) ⇒ void

This method returns an undefined value.

Broadcasts an update action for the model instance.

Parameters:

  • target (String)

    DOM target to replace



28
29
30
# File 'app/models/concerns/broadcast_hub/broadcaster.rb', line 28

def broadcast_update(target)
  broadcast_action("update", target)
end