File: action_cable.rb

package info (click to toggle)
ruby-noticed 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 324 kB
  • sloc: ruby: 1,186; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 497 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Noticed
  module DeliveryMethods
    class ActionCable < DeliveryMethod
      required_options :message

      def deliver
        channel.broadcast_to stream, evaluate_option(:message)
      end

      def channel
        fetch_constant(:channel) || Noticed::NotificationChannel
      end

      def stream
        evaluate_option(:stream) || recipient
      end
    end
  end
end

ActiveSupport.run_load_hooks :noticed_delivery_methods_action_cable, Noticed::DeliveryMethods::ActionCable