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

Add method to get an array of modules included in a type #14468

Open
Blacksmoke16 opened this issue Apr 9, 2024 · 0 comments
Open

Add method to get an array of modules included in a type #14468

Blacksmoke16 opened this issue Apr 9, 2024 · 0 comments

Comments

@Blacksmoke16
Copy link
Member

Blacksmoke16 commented Apr 9, 2024

This would be the inverse of #8133. Where given a TypeNode, call a method to get an array of modules included in that type. E.g.

module Bar
end

struct Foo
  include Bar
end

# Or maybe `.included_modules` to be more explicit?
{{Foo.included}} # => [Bar] 

EDIT: Or maybe just also use #includers, but have it function based on if it is used on a module vs class/struct TypeNode.

This is currently already possible, but this would just provide a better API compared to:

{{pp Foo.ancestors.select &.module?}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant