Class: ExceptionNotifier::SquashNotifier::BaseNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_notifier/squash_notifier/base.rb

Direct Known Subclasses

SquashRubyNotifier

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ BaseNotifier

Returns a new instance of BaseNotifier.



39
40
41
42
# File 'lib/exception_notifier/squash_notifier/base.rb', line 39

def initialize(options)
  Squash::Ruby.configure default_options.merge(options)
  Squash::Ruby.configure disabled: !Squash::Ruby.configuration(:api_key)
end

Class Method Details

.whitelist_env_filterObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/exception_notifier/squash_notifier/base.rb', line 16

def self.whitelist_env_filter
  # Remove any entries from the 'env' var that are not in the 'whitelisted_env_var' list
  lambda do |env|
    env.select do |key, val|
      #NB: we want to close-over `self` so we can access the class var
      #NB:
      # - When `allowed` is a Regexp, === is like ((a =~ b) ? true : false)
      # - When `allowed` is a String, === is like (a == b.to_str)
      # - When `allowed` is a Symbol, === is (a == b)
      self.whitelisted_env_vars.any? {|allowed|  allowed === key }
    end
  end
end

Instance Method Details

#call(exception, data = {}) ⇒ Object

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/exception_notifier/squash_notifier/base.rb', line 44

def call(exception, data={})
  raise NotImplementedError
end