Ruby Newbie - array/hash help

data_sources.keys.each{ |table_name|
   # some_code
}

This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.

···

-----Original Message-----
From: list-bounce@example.com
[mailto:list-bounce@example.com] On Behalf Of William Carpin
Sent: Wednesday, September 06, 2006 8:47 AM
To: ruby-talk ML
Subject: Ruby Newbie - array/hash help

Given the following code...

my $ds = new DataSources($dbh);
my $data_sources = $ds->getTableNames();

foreach my $table_name (keys %{$data_sources}){
   ...some code...
}

Is there any effective way to reproduce the above foreach
loop in Ruby?
I've been doing research, but I can't make heads or tails of it. Any
assistance would be greatly appreciated.

Or:

   data_sources.each_key { |table_name|
     # ...
   }

James Edward Gray II

···

On Sep 6, 2006, at 9:51 AM, Berger, Daniel wrote:

data_sources.keys.each{ |table_name|
   # some_code
}

<...>

data_sources.keys.each{ |table_name|
   # some_code
}

Or:

data_sources.each_key { |table_name|
#some code
}

Regards,
Rimantas

···

--
http://rimantas.com/