Created
January 19, 2017 07:29
-
-
Save jeantessier/e6576ed8179a100f1a2b8ebbffda7c74 to your computer and use it in GitHub Desktop.
A listener class has a series of handlers, each with a `match` and a `handle` closure. Each closure has an optional `origin` parameter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handlers.findAll { name, handler -> | |
if (handler.match.maximumNumberOfParameters == 1) { | |
handler.match notification | |
} else { | |
handler.match notification, origin | |
} | |
}.each { name, handler -> | |
if (handler.handle.maximumNumberOfParameters == 1) { | |
handler.handle notification | |
} else { | |
handler.handle notification, origin | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment