On Fri, Jun 18, 2010 at 7:03 AM, Evgeniy Dolzhenko <dolze...@gmail.com> wrote:
>> etc. The wild idea is to go and load recursively all the Rails lib >> directories (except perhaps for a few exceptions with side-effects). >> With all Rails libs executed, all hooks executed, etc. introspect in >> memory, and build meaningful docs. You can delegate docstring >> extraction to an existing parser. > > My 2cents: someone actually already implemented "the wild idea" here > http://github.com/dolzenko/reflexive > and here > http://github.com/dolzenko/method_extensions (using Ripper parser). That's fantastic! So the planets are aligned :). > The problems I've encountered: > > class_eval still screws the things up, also pretty often there are > layers of behavior-extending modules included in AR::Base before > you get to the actual behavior-defining method (which will have > the docstring you're interested in). This means that using this > approach you will have to specify where to look up particular > methods (like some methods of AR::Base should be looked up > on AR::Relation, etc.) Sure, I think there will be still unsolvable things for an automated tool, perhaps we have methods dynamically generated inside a method definition, the callbacks stuff is particularly dynamic for example... It won't be perfect, but I guess overall it will significantly much better. Excellent Evgeniy, I need to look into your projects in detail, but from a first impression I think they should be definitely included in the Rails tool-chain, or inspire a custom solution. What I am envisioning at this moment is: 1. There's a script that uses your code to build a static[*] website based on runtime introspection. 2. There's some new macro in unit tests or something to link them to methods, I don't know, something like covers 'Some::Module#some_method' and method_extensions, or an adaptation of it for Rails, would provide a #tests accessor. 3. There's a gorgeous template the script in #1 uses to combine and present everything. -- fxn [*] Unless we introduce user comments, I think it is better to keep it static and simple. User comments are hard I think, that'd be for another thread. A search box would also be included but that can also be static. PS: Ryan, need to think about your proposal, will write back later. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-c...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.