class Loom::Trap::Handler

Public Class Methods

new(&handler) click to toggle source
# File lib/loom/trap.rb, line 31
def initialize(&handler)
  @signal_handle_counts = {}
  @handler = handler
end

Public Instance Methods

handle(signal) click to toggle source
# File lib/loom/trap.rb, line 36
def handle(signal)
  @signal_handle_counts[signal] ||= 0
  @signal_handle_counts[signal] += 1

  @handler.call signal, @signal_handle_counts[signal]
end