Way to extract strings for autocompletion?

Hi. I am developing a free editor for RoR ( http://www.plasmacode.com ).
I am looking for a way to enhance code autocompletion.
F.EX:
While typing “link_” , the editor will propose matching strings to
complete what you are typing, such as : “link_to”,“link_to_remote”,etc…

I guess i could pipe a shell to ri and get some informations, or else?

If using ri is the best choice, i am not an expert : whowwould i extract
methods?

Any tips or help is kindly appreciated…

Thanks,
Marcus