lib/sidekiq/throttled/registry.rb in sidekiq-throttled-0.18.0 vs lib/sidekiq/throttled/registry.rb in sidekiq-throttled-1.0.0.alpha
- old
+ new
@@ -1,10 +1,9 @@
# frozen_string_literal: true
# internal
-require "sidekiq/throttled/strategy"
-require "sidekiq/throttled/utils"
+require_relative "./strategy"
module Sidekiq
module Throttled
# Registred strategies.
#
@@ -12,12 +11,10 @@
module Registry
@strategies = {}
@aliases = {}
class << self
- include Utils
-
# Adds strategy to the registry.
#
# @param (see Strategy#initialize)
# @return [Strategy]
def add(name, **kwargs)
@@ -105,10 +102,10 @@
# @param name [Class, #to_s]
# @return [Strategy, nil]
def find_by_class(name)
return unless Throttled.configuration.inherit_strategies?
- const = name.is_a?(Class) ? name : constantize(name)
+ const = name.is_a?(Class) ? name : Object.const_get(name)
return unless const.is_a?(Class)
const.ancestors.each do |m|
strategy = find(m.name)
return strategy if strategy