2

I have the following method to gather a list of subclasses. For various reasons I can't use ActiveSupport DescendantsTracker.

def self.descendants
  unless @subclasses
    @subclasses = []
    ObjectSpace.each_object(Class) do |subclass|
      if subclass < self # && other conditions
        @subclasses << subclass.to_s.split('::').last
      end
    end
  end
  @subclasses
end

With upgrade to ruby 2.3.1 (which might not be related though), the list started to intermittently contain also values not seen before, like this

"#<Class:#<FairPlay::TLLV::ProtocolVersionsSupported:0x00000003566730>>"

The first question would be what does this denote? I'd be thankfull for pointer to start with.

Re the intermittency - this only comes up in the tests (RSpec) and only if the test case is not ran separately. So I suspect RSpec, but still would like to know what's behind.

Thanks!

1 Answers1

0

This is the eigenclass of an object of class FairPlay::TLLV::ProtocolVersionsSupported. The object in question has an id of 0x00000003566730 / 2.

Are you trying to define a method on such instance / are you mocking one? If you are not or don't even know what this class/object is about, I suggest you track it at runtime.

It most probably has to do with rspec, but it could be a lot of things. Ruby version is not it.

Community
  • 1
  • 1
ndnenkov
  • 35,425
  • 9
  • 72
  • 104