Class: UNotifier::Provider::System::ActionCable

Inherits:
ProviderBase
  • Object
show all
Defined in:
lib/provider/system/action_cable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ProviderBase

#can_notify?

Constructor Details

#initialize(server, channel_name: nil, notification_conditions: []) ⇒ ActionCable

Returns a new instance of ActionCable.



8
9
10
11
12
# File 'lib/provider/system/action_cable.rb', line 8

def initialize(server, channel_name: nil, notification_conditions: [])
  super(notification_conditions: notification_conditions)
  @server = server
  @channel_name = channel_name
end

Instance Attribute Details

#channel_nameObject

Returns the value of attribute channel_name.



6
7
8
# File 'lib/provider/system/action_cable.rb', line 6

def channel_name
  @channel_name
end

#serverObject (readonly)

Returns the value of attribute server.



5
6
7
# File 'lib/provider/system/action_cable.rb', line 5

def server
  @server
end

Instance Method Details

#notify(notification, data) ⇒ Object



14
15
16
17
18
# File 'lib/provider/system/action_cable.rb', line 14

def notify(notification, data)
  return unless can_notify?(notification)

  server.broadcast channel_name.call(notification), data
end

#sensitive?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/provider/system/action_cable.rb', line 20

def sensitive?
  false
end