Class: WhoopsNotifier::Investigator

Inherits:
Object
  • Object
show all
Defined in:
lib/whoops_notifier/investigator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strategy, evidence) ⇒ Investigator

Returns a new instance of Investigator.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
# File 'lib/whoops_notifier/investigator.rb', line 7

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

#evidenceObject

get data from evidence using a strategy to create a report and decide whether it should be ignored



4
5
6
# File 'lib/whoops_notifier/investigator.rb', line 4

def evidence
  @evidence
end

#ignore_reportObject Also known as: ignore_report?

get data from evidence using a strategy to create a report and decide whether it should be ignored



4
5
6
# File 'lib/whoops_notifier/investigator.rb', line 4

def ignore_report
  @ignore_report
end

#reportObject

get data from evidence using a strategy to create a report and decide whether it should be ignored



4
5
6
# File 'lib/whoops_notifier/investigator.rb', line 4

def report
  @report
end

#strategyObject

get data from evidence using a strategy to create a report and decide whether it should be ignored



4
5
6
# File 'lib/whoops_notifier/investigator.rb', line 4

def strategy
  @strategy
end

Instance Method Details

#create_reportObject



19
20
21
# File 'lib/whoops_notifier/investigator.rb', line 19

def create_report
  strategy.call(self)
end

#investigate!Object



15
16
17
# File 'lib/whoops_notifier/investigator.rb', line 15

def investigate!
  create_report
end