Module: PusherFake::Server::ChainTrapHandlers

Defined in:
lib/pusher-fake/server/chain_trap_handlers.rb

Overview

Monkeypatch to ensure previous trap handlers are called when new handlers are added.

See Also:

  • +PusherFake+PusherFake::Server+PusherFake::Server.chain_trap_handlers+

Instance Method Summary collapse

Instance Method Details

#trap(*arguments) ⇒ Object

Ensure a previous trap is chained when a new trap is added.

See Also:

  • PusherFake::Server::ChainTrapHandlers.+Signal+Signal.trap+


14
15
16
17
18
19
20
# File 'lib/pusher-fake/server/chain_trap_handlers.rb', line 14

def trap(*arguments)
  previous_trap = super do
    yield

    previous_trap&.call
  end
end