This project is archived and is in readonly mode.
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
-
Xavier Noria January 17th, 2010 @ 09:53 AM
- Title changed from define anonyomous classes to be reachable to define anonymous classes to be reachable
-
Xavier Noria January 17th, 2010 @ 09:55 AM
I messed up with subclasses_of, it returns descendants which are either anonymous or reachable. That is an error probably in favour of this patch haha.
-
Xavier Noria January 17th, 2010 @ 07:35 PM
- Title changed from define anonymous classes to be reachable to define anonymous modules to be reachable
-
Xavier Noria January 17th, 2010 @ 07:38 PM
Being anonymous or reachable makes sense for modules. I've prepared a second patch with the definitions moved to Module, and with proper file organization.
-
Xavier Noria January 29th, 2010 @ 10:13 AM
This ticket can be closed since reachable? is gone after http://github.com/rails/rails/commit/5f981ff0294ba45aa44ad15aa06397...
-
Jeremy Kemper January 29th, 2010 @ 05:25 PM
- State changed from new to wontfix
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>