From: "joe.yakich@..." Date: 2005-09-10T04:16:30+09:00 Subject: Dynamic method execution problem All, I have been trying to figure out a way to execute a series of methods, only 1 of which is expected to actually run without exception, in a particular order. I haven't figured out how to use send or Method#call, so I was messing with eval, but not with much success (I have problems with argument passing, calling the right method, and so on.) I have been trying this, but it doesn't quite work. (As background information, I'm using the Watir test library, and I want to interact with a web page that may have 1 of 4 different elements, each of which I have methods to access and use.) # Each item in this array is a different method name (I changed the names to # "methodn" from more useful names for the purposes of this question) methods = [ "method1", "method2", "method3", "method4" ] # The ie variable here refers to a Watir::IE object begin my_method = methods.shift puts "Trying #{my_method}" eval "#{my_method}(ie)" end rescue UnknownObjectException if methods.length > 0 retry else raise end Any suggestions? I'm new to Ruby, so perhaps there's a totally different approach that is the standard way to address this. (I was trying stuff inspired from PickAxe 2nd Ed, pg.112 and pg.407-409). Thanks in advance! Joe