Class: Hubbado::Log::Controls::Rollbar

Inherits:
Object
  • Object
show all
Defined in:
lib/hubbado/log/controls/rollbar.rb

Overview

Stands in for the Rollbar module, recording what it was handed rather than sending it. Every level Rollbar answers to is defined, so a handler notifying at a level it should have stayed quiet at is recorded and asserted against rather than raising.

Defined Under Namespace

Classes: Notification

Constant Summary collapse

LEVELS =
%i[debug info warning warn error critical].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exampleObject



26
# File 'lib/hubbado/log/controls/rollbar.rb', line 26

def self.example = new

Instance Method Details

#notificationsObject



28
# File 'lib/hubbado/log/controls/rollbar.rb', line 28

def notifications = @notifications ||= []

#notified?(level = nil) ⇒ Boolean

Without a level, whether anything was sent at all — which a spec asserting silence would otherwise have to infer from an attribute never having been set.

Returns:

  • (Boolean)


36
37
38
39
40
# File 'lib/hubbado/log/controls/rollbar.rb', line 36

def notified?(level = nil)
  return !notifications.empty? if level.nil?

  notifications.any? { |notification| notification.level == level.to_s.to_sym }
end