ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
Re: Executing one of several ruby objects
by Robert Klemme other posts by this author
Nov 5 2009 12:13AM messages near this date
Re: Executing one of several ruby objects | Re: Executing one of several ruby objects
2009/11/5 dhf0820@[...].com <dhf0820@[...].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 end
http://blog.rubybestpractices.com/
Thread:
Dhf0820@Gmail.Com
James Britt
Robert Klemme
Don French
Robert Klemme
David Masover
Robert Klemme
Don French
Joel VanderWerf
Don French
Aldric Giacomoni

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved