L
Lyle Johnson
I'm interested in parsing some Ruby code for the purpose of extracting
information about the method signatures (including argument names and
default argument values). For example, if I had a method like:
def foo(a, b=2, c=3)
...
end
I'd like to be able to programmatically determine that I have a method
named "foo", with arguments "a", "b" and "c", with defaults of 2 and 3
for the latter two arguments. (I will use that information about the
method signatures to generate some additional code.)
Does anyone have any experience with this? I looked at the XML
generator for RDoc, but its output doesn't appear to provide this kind
of information. Ryan's ParseTree library may do the trick, or worst
case, I could write some kind of custom parsing tool myself. Just
wanted to see if anyone has any thoughts on this.
information about the method signatures (including argument names and
default argument values). For example, if I had a method like:
def foo(a, b=2, c=3)
...
end
I'd like to be able to programmatically determine that I have a method
named "foo", with arguments "a", "b" and "c", with defaults of 2 and 3
for the latter two arguments. (I will use that information about the
method signatures to generate some additional code.)
Does anyone have any experience with this? I looked at the XML
generator for RDoc, but its output doesn't appear to provide this kind
of information. Ryan's ParseTree library may do the trick, or worst
case, I could write some kind of custom parsing tool myself. Just
wanted to see if anyone has any thoughts on this.