lib/eco/api/common/class_auto_loader.rb in eco-helpers-2.4.8 vs lib/eco/api/common/class_auto_loader.rb in eco-helpers-2.4.9
- old
+ new
@@ -78,12 +78,18 @@
return false if !autoloaded_class || @loading_children
pending_children = unloaded_children
return false if pending_children.empty?
@loading_children = true
pending_children.each do |klass|
- @child = klass.new(object)
- autoloaded_children.push(klass)
+ begin
+ @child = klass.new(object)
+ rescue TypeError => e
+ # Can't create from this class (must be the singleton class)
+ # Just ignore
+ ensure
+ autoloaded_children.push(klass)
+ end
end
@loading_children = false
true
end
@@ -100,10 +106,9 @@
# List all new namespaces
def new_classes
ObjectSpace.each_object(::Class).to_a - known_classes
end
-
end
end
end
end