Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Class#subclasses for DescendantTracker #64

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

flash-gordon
Copy link
Member

This is a 3.1+ feature. I would expect this to work slower compared to the previous implementation, OTOH .descendants normally called a limited number of times. Also, the new version doesn't hold hard references to classes which is good for code reloading.

@@ -18,6 +18,6 @@ class Grandchild < Child
end

it "tracks descendants" do
expect(Test::Parent.descendants).to eql([Test::Grandchild, Test::Child])
expect(Test::Parent.descendants).to eql([Test::Child, Test::Grandchild])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a breaking change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it'll be. But I think it's fine since it's now consistent with subclasses and other implementations. Application-wise this shouldn't be a problem for all/almost all cases IMO. Nobody declared the order of the collection, it could be a set as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're still 0.x btw

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I know, just pointing it out, as it's something worth mentioning in the changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants