Module: Sidekiq::Extensions::PsychAutoload

Defined in:
lib/sidekiq/delay.rb

Instance Method Summary collapse

Instance Method Details

#resolve_class(klass_name) ⇒ Object


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/sidekiq/delay.rb', line 27

def resolve_class(klass_name)
  return nil if !klass_name || klass_name.empty?
  # constantize
  names = klass_name.split('::')
  names.shift if names.empty? || names.first.empty?

  names.inject(Object) do |constant, name|
    constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
  end
rescue NameError
  super
end