mmcgrana / simple_callbacks
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
README.textile | ||
| |
lib/ | ||
| |
simple_callbacks.gemspec | ||
| |
spec/ |
README.textile
SimpleCallbacks
Generic callback functionality
Overview
Declare callbacks with the define_callback macro:
class Demo include SimpleCallbacks define_callback :before_save define_callback :after_save endOnce callbacks are declared, add actions to their respective callback action
lists by using the class methods named after the callback. You can use :if
and :unless for granular controller over when callbacks are run:
You can then invoke he callbacks on instances of the class. Invoking a
callback will run all of its applicable actions in the order they were
declared:
You can introspect on the declared callbacks by calling .callbacks on the
class in question,
SimpleCallbacks purposely does not support sharing callback queues up the inheritance
hierarchy, as we believe this introduces more confusion that benefits.

