Module: Signal

Defined in:
lib/fsevent/signal_ext.rb

Class Method Summary collapse

Class Method Details

.handle(signal) ⇒ Object



17
18
19
20
21
# File 'lib/fsevent/signal_ext.rb', line 17

def handle(signal)
  if handler = handlers[int_for_signal(signal)]
    handler.call
  end
end

.handlersObject



5
6
7
# File 'lib/fsevent/signal_ext.rb', line 5

def handlers
  @handlers ||= {}
end

.handles?(signal) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/fsevent/signal_ext.rb', line 13

def handles?(signal)
  handlers.has_key? int_for_signal(signal)
end

.trap(signal, &block) ⇒ Object



9
10
11
# File 'lib/fsevent/signal_ext.rb', line 9

def trap(signal, &block)
  handlers[int_for_signal(signal)] = block
end

.trap_without_custom_handlersObject



3
# File 'lib/fsevent/signal_ext.rb', line 3

alias trap_without_custom_handlers trap