how to check if script in a file a method?

K

konsu

hello,

given a text string with ruby code, that my program evaluates at some point
inside an anonymous module, is there a way to analyse the code without
evaluating it inside a module to tell if it implements a particular method?

i have a bunch of strings like that and i want to present the list of them
to the user but i need to show what these scripts do so that she could
choose. after that i do evaluate the chosen one in a module and use it.
evaluating all of them and using respond_to? before displaying the selection
list seems ugly. is parsing the only alternative?

something similar to lisp's quote operator (which turns any list in to just
a data list)?

thanks
konstantin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,665
Latest member
salkete

Latest Threads

Top