Hi,
I am trying to find all the subclasses of a certain type called Command
in Ruby, and I came across the following code which did the trick perfectly, however I don't really understand how it works, mainly the class << [Subtype]
part. I have tried reading up on this, but I feel there is still some Ruby magic which I am missing. Can someone please explain this to me :-)
ObjectSpace.enum_for(:each_object, class << Command; self; end).to_a()