Class: Exceptions::Backends::Multi

Inherits:
Exceptions::Backend show all
Defined in:
lib/exceptions/backends/multi.rb

Overview

Public: Multi is an implementation of the Backend interface for wrapping multiple backends as a single Backend.

Defined Under Namespace

Classes: MultiResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Exceptions::Backend

#clear_context, #context

Constructor Details

#initialize(*backends) ⇒ Multi

Returns a new instance of Multi.



8
9
10
# File 'lib/exceptions/backends/multi.rb', line 8

def initialize(*backends)
  @backends = backends
end

Instance Attribute Details

#backendsObject (readonly)

Returns the value of attribute backends.



6
7
8
# File 'lib/exceptions/backends/multi.rb', line 6

def backends
  @backends
end

Instance Method Details

#notify(exception, options = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/exceptions/backends/multi.rb', line 12

def notify(exception, options = {})
  results = backends.map do |backend|
    backend.notify exception, options
  end

  MultiResult.new results.map(&:id), results.map(&:url)
end