Module: WhoopsNotifier

Defined in:
lib/whoops_notifier.rb,
lib/whoops_notifier/report.rb,
lib/whoops_notifier/sender.rb,
lib/whoops_notifier/strategy.rb,
lib/whoops_notifier/investigator.rb

Defined Under Namespace

Classes: Investigator, Report, Sender, Strategy

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



13
14
15
# File 'lib/whoops_notifier.rb', line 13

def config
  @config
end

.strategiesObject

Returns the value of attribute strategies.



13
14
15
# File 'lib/whoops_notifier.rb', line 13

def strategies
  @strategies
end

Class Method Details

.notify(evidence) ⇒ Object .notify(strategy_name, evidence) ⇒ Object

Overloads:

  • .notify(evidence) ⇒ Object

    Notify using the default basic strategy

    Parameters:

    • evidence (Hash)

      the evidence expected by the basic strategy, used by strategy to build report

  • .notify(strategy_name, evidence) ⇒ Object

    Parameters:

    • strategy_name (Symbol, String)
    • evidence (Hash)

      same as above



21
22
23
24
25
26
27
28
29
# File 'lib/whoops_notifier.rb', line 21

def notify(strategy_name, evidence = {})
  if strategy_name.is_a? Hash
    notify("default::basic", strategy_name)
  else
    investigator = Investigator.new(strategies[strategy_name], evidence)
    investigator.investigate!
    send_report(investigator.report) unless investigator.ignore_report?
  end
end

.send_report(report) ⇒ Object



31
32
33
# File 'lib/whoops_notifier.rb', line 31

def send_report(report)
  Sender.new(WhoopsNotifier.config.to_hash).send_report(report.to_hash)
end