Sha256: f322c8e8b1741a4a6520ef67bceca8339f64e4575b49dd16bc833ce23115c2c7
Contents?: true
Size: 600 Bytes
Versions: 4
Compression:
Stored size: 600 Bytes
Contents
# $Id$ class Object #:nodoc: def remove_subclasses_of(superclass) subclasses_of(superclass).each { |subclass| Object.send(:remove_const, subclass) rescue nil } end def subclasses_of(superclass) subclasses = [] ObjectSpace.each_object(Class) do |k| next if !k.ancestors.include?(superclass) || superclass == k || k.to_s.include?("::") || subclasses.include?(k.to_s) subclasses << k.to_s end subclasses end end class Class #:nodoc: def remove_subclasses Object.remove_subclasses_of(self) end def subclasses Object.subclasses_of(self) end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
nitro-0.9.5 | lib/glue/object.rb |
nitro-0.9.3 | lib/glue/object.rb |
og-0.9.3 | lib/glue/object.rb |
og-0.9.5 | lib/glue/object.rb |