From: Thomas Mueller Date: 2008-03-05T12:32:33+09:00 Subject: Re: Inspecting a block given to a method I think that'll be sufficient. My goal is to make it easy for the user (which is mainly myself) to be lazy :-) and activate the fields automatically. If I can't capture the usage of some fields sometimes then those fields can still manually be activated. I'm already installing ParseTree and will try that out. Looks promising. Thanks a lot. 2008/3/5, Christopher Dicely : > > > Hmm. That's trickier. You could create an method on some convenient class > (or object) from the block with define_method, and then use ParseTree to get > the parse tree of that method, and walk through the resulting s-expression to > find out which fields are called. Though if any of the fields are determined > dynamically, that won't work, because you won't have the results of the > dynamic determination, just the parse tree of the code that would get it. > > (My ParseTree-fu isn't strong enough to sketch out code to demonstrate that, > but conceptually, with the caveat about dynamic determination of fields, > it seems at least possible.) > >