class SidekiqUniqueJobs::Config
def add_strategy(name, klass)
-
klass
(Class
) -- the class describing the strategy -
name
(String
) -- the name of the custom strategy
Raises:
-
(DuplicateStrategy)
- when the name already exists
Other tags:
- Example: Add a custom strategy -
def add_strategy(name, klass) strategy_sym = name.to_sym raise DuplicateStrategy, ":#{name} already defined, please use another name" if strategies.key?(strategy_sym) new_strategies = strategies.dup.merge(strategy_sym => klass).freeze self.strategies = new_strategies end