class Honeybadger::Config::Ruby

Public Instance Methods

backend() click to toggle source
# File lib/honeybadger/config/ruby.rb, line 80
def backend
  get(:backend) || config.backend
end
backend=(backend) click to toggle source
# File lib/honeybadger/config/ruby.rb, line 76
def backend=(backend)
  hash[:backend] = backend
end
backtrace_filter(&block) click to toggle source
# File lib/honeybadger/config/ruby.rb, line 96
def backtrace_filter(&block)
  if block_given?
    logger.warn('DEPRECATED: backtrace_filter is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#backtrace_filter')
    hash[:backtrace_filter] = block if block_given?
  end

  get(:backtrace_filter)
end
before_notify(action = nil, &block) click to toggle source
# File lib/honeybadger/config/ruby.rb, line 84
def before_notify(action = nil, &block)
  hooks = Array(get(:before_notify)).dup

  if action && validate_before_action(action)
    hooks << action
  elsif block_given? && validate_before_action(block)
    hooks << block
  end

  hash[:before_notify] = hooks
end
exception_filter(&block) click to toggle source
# File lib/honeybadger/config/ruby.rb, line 105
def exception_filter(&block)
  if block_given?
    logger.warn('DEPRECATED: exception_filter is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#exception_filter')
    hash[:exception_filter] = block
  end

  get(:exception_filter)
end
exception_fingerprint(&block) click to toggle source
# File lib/honeybadger/config/ruby.rb, line 114
def exception_fingerprint(&block)
  if block_given?
    logger.warn('DEPRECATED: exception_fingerprint is deprecated. Please use before_notify instead. See https://docs.honeybadger.io/ruby/support/v4-upgrade#exception_fingerprint')
    hash[:exception_fingerprint] = block
  end

  get(:exception_fingerprint)
end
logger() click to toggle source
# File lib/honeybadger/config/ruby.rb, line 72
def logger
  get(:logger) || config.logger
end
logger=(logger) click to toggle source
# File lib/honeybadger/config/ruby.rb, line 68
def logger=(logger)
  hash[:logger] = logger
end

Private Instance Methods

validate_before_action(action) click to toggle source
# File lib/honeybadger/config/ruby.rb, line 125
def validate_before_action(action)
  if !action.respond_to?(:call)
    logger.warn(
      'You attempted to add a before notify hook that does not respond ' \
      'to #call. We are discarding this hook so your intended behavior ' \
      'will not occur.'
    )
    false
  elsif action.arity != 1
    logger.warn(
      'You attempted to add a before notify hook that has an arity ' \
      'other than one. We are discarding this hook so your intended ' \
      'behavior will not occur.'
    )
    false
  else
    true
  end
end