From: Vincent Fourmond Date: 2006-12-24T01:08:53+09:00 Subject: Re: Help with a ruby idiom Tim Waters wrote: >>From the O'Reilly Cookbook there is code that keeps call functions in a > hash as a subscriber/listener type pattern. What I don't understand (or > I don't understand how it works is the line: > (@EventDispatcher_listeners[event] ||= []) << callback You can split it into two, which will make it more clear: @EventDispatcher_listeners[event] ||= [] # makes it an empty array if it doesn't exist @EventDispatcher_listeners[event] << callback # and pushes the callback on top of it I agree that this kind of compact notation is very hand but slightly indecipherable... Cheers, Vince -- Vincent Fourmond, PhD student http://vincent.fourmond.neuf.fr/