Class: Async::Signals::Handlers

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/async/signals/handlers.rb

Overview

Represents a configurable set of signal handlers.

Instance Method Summary collapse

Constructor Details

#initializeHandlers

Initialize the handlers.



13
14
15
# File 'lib/async/signals/handlers.rb', line 13

def initialize
	@signals = {}
end

Instance Method Details

#each(&block) ⇒ Object

Iterate over the configured signal handlers.



31
32
33
# File 'lib/async/signals/handlers.rb', line 31

def each(&block)
	@signals.each(&block)
end

#ignore(signal) ⇒ Object

Ignore a signal while these handlers are installed.



25
26
27
# File 'lib/async/signals/handlers.rb', line 25

def ignore(signal)
	trap(signal)
end

#trap(signal, &block) ⇒ Object

Trap a signal while these handlers are installed.



19
20
21
# File 'lib/async/signals/handlers.rb', line 19

def trap(signal, &block)
	@signals[normalize(signal)] = block
end