|
# File test/unit/util/observable.rb, line 31
def add_listener(channel_name, listener_key=NOTHING, &listener) # :yields: value
unless(block_given?)
raise ArgumentError.new("No callback was passed as a listener")
end
key = listener_key
if (listener_key == NOTHING)
listener_key = listener
key = ProcWrapper.new(listener)
end
channels[channel_name] ||= Hash.new
channels[channel_name][key] = listener
return listener_key
end
|