mirror of
https://github.com/endofunky/sidetiq.git
synced 2022-11-09 13:53:30 -05:00
20 lines
363 B
Ruby
20 lines
363 B
Ruby
module Sidetiq
|
|
module SubclassTracking
|
|
def subclasses(deep = false)
|
|
@subclasses ||= []
|
|
|
|
if deep
|
|
@subclasses.inject([]) do |all, subclass|
|
|
(all << subclass) + subclass.subclasses(true)
|
|
end
|
|
else
|
|
@subclasses
|
|
end
|
|
end
|
|
|
|
def inherited(klass)
|
|
super
|
|
subclasses << klass
|
|
end
|
|
end
|
|
end
|