Class: WhoopsNotifier::Investigator
- Inherits:
-
Object
- Object
- WhoopsNotifier::Investigator
- Defined in:
- lib/whoops_notifier/investigator.rb
Overview
A “glue” class which coordinates report creation
Instance Attribute Summary collapse
-
#evidence ⇒ Object
get data from evidence using a strategy to create a report and decide whether it should be ignored.
-
#report ⇒ Object
get data from evidence using a strategy to create a report and decide whether it should be ignored.
-
#strategy ⇒ Object
get data from evidence using a strategy to create a report and decide whether it should be ignored.
Instance Method Summary collapse
- #ignore_report? ⇒ Boolean
-
#initialize(strategy, evidence) ⇒ Investigator
constructor
A new instance of Investigator.
- #investigate! ⇒ Object
Constructor Details
#initialize(strategy, evidence) ⇒ Investigator
Returns a new instance of Investigator.
8 9 10 11 12 13 14 |
# File 'lib/whoops_notifier/investigator.rb', line 8 def initialize(strategy, evidence) raise ArgumentError, "strategy can not be nil" if strategy.nil? raise ArgumentError, "strategy must respond to 'call'" unless strategy.respond_to?(:call) self.strategy = strategy self.evidence = evidence self.report = Report.new end |
Instance Attribute Details
#evidence ⇒ Object
get data from evidence using a strategy to create a report and decide whether it should be ignored
6 7 8 |
# File 'lib/whoops_notifier/investigator.rb', line 6 def evidence @evidence end |
#report ⇒ Object
get data from evidence using a strategy to create a report and decide whether it should be ignored
6 7 8 |
# File 'lib/whoops_notifier/investigator.rb', line 6 def report @report end |
#strategy ⇒ Object
get data from evidence using a strategy to create a report and decide whether it should be ignored
6 7 8 |
# File 'lib/whoops_notifier/investigator.rb', line 6 def strategy @strategy end |
Instance Method Details
#ignore_report? ⇒ Boolean
20 21 22 |
# File 'lib/whoops_notifier/investigator.rb', line 20 def ignore_report? report.ignore? end |
#investigate! ⇒ Object
16 17 18 |
# File 'lib/whoops_notifier/investigator.rb', line 16 def investigate! strategy.call(report, evidence) end |