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

21 lines
363 B
Ruby
Raw Permalink Normal View History

2013-09-17 11:48:08 -04:00
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