This project is archived and is in readonly mode.

#3722 ✓wontfix
Xavier Noria

define anonymous modules to be reachable

Reported by Xavier Noria | January 17th, 2010 @ 09:52 AM

Class#reachable? is defined for all classes, but the predicate raises an error if the class is anonymous because it evals malformed Ruby.

The goal of reachable? seems to be to look for class objects that are not anonymous but whose constant is gone or stores another object.

So the behaviour with anonymous classes seems to be just a technical detail and it would be easier if that was checked by the predicate itself (currently client code calls name.blank? by hand before). Also documentation would be clearer because now we have to say that subclasses_of returns descendants except for anonymous or reachable ones. It would be better if we could document subclasses_of returns all reachable descendants.

The patch adds tests for reachable? (there were none before), and defines also anonymous?.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages