File: raise.rb

package info (click to toggle)
ruby-uniform-notifier 1.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 240 kB
  • sloc: ruby: 915; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 493 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
22
23
# frozen_string_literal: true

class UniformNotifier
  class Raise < Base
    class << self
      def active?
        defined?(@exception_class) ? @exception_class : false
      end

      def setup_connection(exception_class)
        @exception_class = exception_class == true ? Exception : exception_class
      end

      protected

      def _out_of_channel_notify(data)
        message = data.values.compact.join("\n")

        raise @exception_class, message
      end
    end
  end
end