Sha256: 02beeb8d9cefe1f029eec8f7b0242558d9a7bbc4acca5383f2347ea307bcaa8f

Contents?: true

Size: 363 Bytes

Versions: 14

Compression:

Stored size: 363 Bytes

Contents

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
sidetiq-0.7.2 lib/sidetiq/subclass_tracking.rb
sidetiq-0.7.1 lib/sidetiq/subclass_tracking.rb
sidetiq-0.7.0 lib/sidetiq/subclass_tracking.rb
sidetiq-0.6.3 lib/sidetiq/subclass_tracking.rb
sidetiq-0.6.2 lib/sidetiq/subclass_tracking.rb
sidetiq-0.6.1 lib/sidetiq/subclass_tracking.rb
sidetiq-0.6.0 lib/sidetiq/subclass_tracking.rb
sidetiq-0.5.0 lib/sidetiq/subclass_tracking.rb
sidetiq-0.4.3 lib/sidetiq/subclass_tracking.rb
sidetiq-0.4.2 lib/sidetiq/subclass_tracking.rb
sidetiq-0.4.1 lib/sidetiq/subclass_tracking.rb
sidetiq-0.4.0 lib/sidetiq/subclass_tracking.rb
sidetiq-0.4.0.rc4 lib/sidetiq/subclass_tracking.rb
sidetiq-0.4.0.rc3 lib/sidetiq/subclass_tracking.rb