class Guard::Dsl
def callback(*args, &block)
- Yield: - a callback block
Parameters:
-
args
(Array
) -- the callback arguments
Other tags:
- Example: Add callback before the `start` and `stop` actions. -
Example: Add callback before the `reload` action. -
def callback(*args, &block) @plugin_options ||= nil fail "callback must be called within a guard block" unless @plugin_options block, events = if args.size > 1 # block must be the first argument in that case, the # yielded block is ignored args else [block, args[0]] end @plugin_options[:callbacks] << { events: events, listener: block } end