Module: Wamupd::Signals

Included in:
AvahiModel, DNSAvahiController, DNSIpController
Defined in:
lib/wamupd/signals.rb

Overview

Mixin for basic event-driven processing. Listeners register using the on function. Classes which include Signals can raise a signal with the signal function.

Instance Method Summary collapse

Instance Method Details

#on(name, &action) ⇒ Object

Add a handler for the specified signal

Args:

name

An atom of the signal name



28
29
30
31
32
33
34
35
36
# File 'lib/wamupd/signals.rb', line 28

def on(name, &action) # :yields: parameters
    if (not @handlers)
        @handlers = Hash.new
    end
    if (not @handlers.has_key?(name))
        @handlers[name] = []
    end
    @handlers[name] << action
end