[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01978] Re: Iterating over all instances of a class

From: OZAWA Sakuro <crouton@...>
Date: 2000-03-17 16:24:37 UTC
List: ruby-talk #1978
In article <s8d205e0.020@email1.cuna.com>,
    David Douthitt writes:

> I just KNOW this is related to "collection" somehow, or that there is a way to do this.
>However, the way I do it now is to create an array of instances, 
>but this creates some unwieldy *.find{ |i| .... } sequences and 
>worse.  Can't I do a find over instances of a class?

oll_instances_of_Foo = []
OblectSpace.each_object(Foo) do |obj|
  all_instances_of_Foo << obj
end

-- 
OZAWA -Crouton- Sakuro
<mailto:crouton@duelists.org> <http://www.duelists.org/~crouton/>
PGP指紋: C98F 74E0 AEEB 4578 1DFC  F650 3BE0 9627 11FC C9F5

In This Thread

Prev Next