-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 Module#anonymous?
.
#7966
base: master
Are you sure you want to change the base?
Add Module#anonymous?
.
#7966
Conversation
@@ -52,6 +52,14 @@ static inline void ROBJ_TRANSIENT_UNSET(VALUE obj); | |||
*/ | |||
VALUE rb_mod_set_temporary_name(VALUE, VALUE); | |||
|
|||
/** | |||
* Return whether the module is anonymous or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be useful to document what it does for modules with anonymous elements in the "namespace path", e.g.
Class.new.tap { _1::C = Class.new }::C.anonymous? # true or false ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still considered anonymous but if we accept this proposal I'll write a full set of specs.
Try on Playground: https://ruby.github.io/play-ruby?run=10952250729 |
f5648f9
to
db90572
Compare
Needs tests. |
db90572
to
3a70a12
Compare
https://bugs.ruby-lang.org/issues/19742