module Guard
def add_guard(name, watchers = [], callbacks = [], options = {})
-
(Guard::Guard)
- the guard added
Parameters:
-
options
(Hash
) -- the Guard options (see the given Guard documentation) -
callbacks
(Array
) -- the list of callbacks -
watchers
(Array
) -- the list of declared watchers -
name
(String
) -- the Guard name
def add_guard(name, watchers = [], callbacks = [], options = {}) if name.to_sym == :ego UI.deprecation('Guard::Ego is now part of Guard. You can remove it from your Guardfile.') else guard_class = get_guard_class(name) callbacks.each { |callback| Hook.add_callback(callback[:listener], guard_class, callback[:events]) } guard = guard_class.new(watchers, options) @guards << guard guard end end