Module: WithModel::DescendantsTracker

Defined in:
lib/with_model/descendants_tracker.rb

Overview

Defined Under Namespace

Modules: DestroyedClassesFiltering Classes: WeakSet

Class Method Summary collapse

Class Method Details

.clear(classes) ⇒ Object

:nodoc:



48
49
50
51
52
53
54
55
# File 'lib/with_model/descendants_tracker.rb', line 48

def clear(classes) # :nodoc:
  classes.each do |klass|
    @excluded_descendants << klass
    klass.descendants.each do |descendant|
      @excluded_descendants << descendant
    end
  end
end

.reject!(classes) ⇒ Object

:nodoc:



57
58
59
60
61
62
# File 'lib/with_model/descendants_tracker.rb', line 57

def reject!(classes) # :nodoc:
  if @excluded_descendants
    classes.reject! { |d| @excluded_descendants.include?(d) }
  end
  classes
end