From: Don French Date: 2009-11-06T04:15:14+09:00 Subject: Re: Executing one of several ruby objects On Nov 4, 10:13 pm, Robert Klemme wrote: > 2009/11/5 dhf0...@gmail.com : > > > I am trying to write a program that will load a series of DSLs (ruby > > files) into it and then call the same class method in each one until > > one returns something other than nil.  The current DSL is just a ruby > > class that subclasses the same "descriptor" superclass. The number of > > DSLs loaded is not know until runtime as it is all the files in a > > directory. > > > Any pointers on this? > > Not sure what you're after but it seems a simple iteration will do: > > res = nil > class = classes.find {|cl| res = cl.your_method} > > If you do not need the class you can remove the second assignment. > > Kind regards > > robert > > -- > remember.guy do |as, often| as.you_can - without endhttp://blog.rubybestpractices.com/ Thank you for the reply. The problem is normally you have to specify each of the modules or external classes you are going to use in the source. That does not work. They are not know until run-time. It will include rb file from a specified director. Each of the files in the directory will have a "descriptor" in it that has the "identification" class method that will be called. When it identifies what is should it will return a non nil object. I understanding the calling of the method, it is how to load each of those files into an array so that they can be executed when needed. I am probably making this harder than it should be. Mahalo (thank you) Don