1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00
endofunky--sidetiq/lib/sidetiq/subclass_tracking.rb
2013-09-17 16:48:08 +01:00

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