Class: Telebugs::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/telebugs/reporter.rb

Overview

Reporter is reponsible for sending reports to Telebugs.

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReporter

Returns a new instance of Reporter.



14
15
16
17
# File 'lib/telebugs/reporter.rb', line 14

def initialize
  @sender = Sender.new
  @config = Config.instance
end

Class Attribute Details

.instanceObject



9
10
11
# File 'lib/telebugs/reporter.rb', line 9

def instance
  @instance ||= new
end

Instance Method Details

#report(error) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/telebugs/reporter.rb', line 19

def report(error)
  Telebugs::Promise.new(error) do
    report = Report.new(error)

    @config.middleware.call(report)
    next if report.ignored

    @sender.send(report)
  end
end