Class: Findbug::Alerts::Channels::Base
- Inherits:
-
Object
- Object
- Findbug::Alerts::Channels::Base
- Defined in:
- lib/findbug/alerts/channels/base.rb
Overview
Base is the abstract base class for alert channels.
CHANNEL PATTERN
Each channel implements:
-
#initialize(config) - Receive channel configuration
-
#send_alert(error_event) - Send the alert
This pattern allows adding new channels easily:
class PagerDuty < Base
def send_alert(error_event)
# Call PagerDuty API
end
end
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ Base
constructor
A new instance of Base.
-
#send_alert(error_event) ⇒ Object
Send an alert for an error event.
Constructor Details
#initialize(config) ⇒ Base
Returns a new instance of Base.
26 27 28 |
# File 'lib/findbug/alerts/channels/base.rb', line 26 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
24 25 26 |
# File 'lib/findbug/alerts/channels/base.rb', line 24 def config @config end |
Instance Method Details
#send_alert(error_event) ⇒ Object
Send an alert for an error event
34 35 36 |
# File 'lib/findbug/alerts/channels/base.rb', line 34 def send_alert(error_event) raise NotImplementedError, "#{self.class} must implement #send_alert" end |