Phil
Its a long shot but as a nasty hack you could read the original source
file in and search to locate the “def” of the method and then via a
regex extract the names of the arguments. This would likely be very
slow so you’d probably want to do it once and for all for all methods
of interest. But, as a circular problem, how would you know the names
of the methods of interest in advance? Well, that would have to be an
assumption I suppose.
Is this possible somehow? I feel like it should be, but I can’t quite
Maybe there will be a built-in way to do this in 2.0?
Phil
Its a long shot but as a nasty hack you could read the original source
file in and search to locate the “def” of the method and then via a
regex extract the names of the arguments. This would likely be very
slow so you’d probably want to do it once and for all for all methods
of interest. But, as a circular problem, how would you know the names
of the methods of interest in advance? Well, that would have to be an
assumption I suppose.
If you’re going to do that you might as well use ParseTree.
Is there a way to reflect on a method to get the declard names of the
parameters?
[…]
Is this possible somehow? I feel like it should be, but I can’t quite
figure it out.
What is the use case for this sort of thing? Off hand the only reason
I could see needing this would be for some sort of debugger/ide/
development
tool, in which case ParseTree might be a solution.
Gary W.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.