Yes, sort of. :-)
I had to implement a similar feature (grab the source of a block) as part of Wrong and you can see how (and maybe even reuse the code) in chunk.rb (which relies on Ryan Davis' RubyParser as well as some pretty funny source file glomming code). You'd have to modify it to use Method#source_location
and maybe tweak some other things so it does or doesn't include the def
.
BTW I think Rubinius has this feature built in. For some reason it's been left out of MRI (the standard Ruby implementation), hence the hack.
Update: this answer points us to the method_source gem which seems to be a (relatively) clean, one-shot solution, using a similar algorithm (keep glomming lines from a source file until you stop getting parse errors).