Module: Fortitude::Widget::ModulesAndSubclasses::ClassMethods

Defined in:
lib/fortitude/widget/modules_and_subclasses.rb

Instance Method Summary collapse

Instance Method Details

#all_fortitude_superclassesObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fortitude/widget/modules_and_subclasses.rb', line 14

def all_fortitude_superclasses
  @all_fortitude_superclasses ||= begin
    if self.name == ::Fortitude::Widget.name
      [ ]
    else
      out = [ ]
      klass = superclass
      while true
        out << klass
        break if klass.name == ::Fortitude::Widget.name
        klass = klass.superclass
      end
      out
    end
  end
end

#inherited(subclass) ⇒ Object

INTERNAL USE ONLY – RUBY CALLBACK



40
41
42
43
44
# File 'lib/fortitude/widget/modules_and_subclasses.rb', line 40

def inherited(subclass)
  unless direct_subclasses.detect { |sc| sc.equal?(subclass) }
    @direct_subclasses << ::Ref::WeakReference.new(subclass)
  end
end