Class: Crashdesk::ReportManager

Inherits:
Object
  • Object
show all
Defined in:
lib/crashdesk/report_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reporters = [:remote, :logger]) ⇒ ReportManager

Returns a new instance of ReportManager.



6
7
8
9
10
11
12
13
14
# File 'lib/crashdesk/report_manager.rb', line 6

def initialize(reporters = [:remote, :logger])
  @reporters = reporters.map do |reporter|
    if reporter.respond_to? :run
      reporter
    else
      constantize(reporter).new(host: Crashdesk.configure.host, port: Crashdesk.configure.port)
    end
  end
end

Instance Attribute Details

#reportersObject (readonly)

Returns the value of attribute reporters.



4
5
6
# File 'lib/crashdesk/report_manager.rb', line 4

def reporters
  @reporters
end

Instance Method Details

#process(crashlog) ⇒ Object



16
17
18
19
20
# File 'lib/crashdesk/report_manager.rb', line 16

def process(crashlog)
  reporters.map do |reporter|
    reporter.run(crashlog)
  end
end