Class: Newshound::Exceptions::Base
- Inherits:
-
Object
- Object
- Newshound::Exceptions::Base
- Defined in:
- lib/newshound/exceptions/base.rb
Overview
Base class for exception source adapters Each adapter is responsible for:
-
Fetching recent exceptions from its specific exception tracking system
-
Formatting exception data for reports and banners
Subclasses must implement:
-
#recent(time_range:, limit:) - Returns a collection of exception records
-
#format_for_report(exception) - Formats a single exception for Slack/report display
-
#format_for_banner(exception) - Formats a single exception for banner UI
Direct Known Subclasses
Instance Method Summary collapse
-
#format_for_banner(exception) ⇒ Hash
Formats an exception for banner UI display.
-
#format_for_report(exception, number) ⇒ String
Formats an exception for report/Slack display.
-
#initialize(config = {}) ⇒ Base
constructor
A new instance of Base.
-
#recent(time_range:, limit:) ⇒ Array
Fetches recent exceptions from the exception tracking system.
Constructor Details
#initialize(config = {}) ⇒ Base
Returns a new instance of Base.
13 14 15 |
# File 'lib/newshound/exceptions/base.rb', line 13 def initialize(config = {}) @config = config end |
Instance Method Details
#format_for_banner(exception) ⇒ Hash
Formats an exception for banner UI display
39 40 41 |
# File 'lib/newshound/exceptions/base.rb', line 39 def (exception) raise NotImplementedError, "#{self.class} must implement #format_for_banner" end |
#format_for_report(exception, number) ⇒ String
Formats an exception for report/Slack display
31 32 33 |
# File 'lib/newshound/exceptions/base.rb', line 31 def format_for_report(exception, number) raise NotImplementedError, "#{self.class} must implement #format_for_report" end |
#recent(time_range:, limit:) ⇒ Array
Fetches recent exceptions from the exception tracking system
22 23 24 |
# File 'lib/newshound/exceptions/base.rb', line 22 def recent(time_range:, limit:) raise NotImplementedError, "#{self.class} must implement #recent" end |