First – thanks Guy, that solved that problem and allowed me to find and
move on to the next.
Let’s say I have a reference to an object called “contact” and it has an
attribute “phone”. The atrribute phone can be legally set like this:
contact.phone = “703-277-7272”
But, let’s say I have a variable, called meth. And meth == “phone”. I want
to use my variable meth like this:
contact.meth = “703-277-7272” # this should set phone
I tried using @meth, but I get a parse error. How would I go about doing
this?
-Dwayne
···
-----Original Message-----
From: ts [mailto:decoux@moulon.inra.fr]
Sent: Sunday, February 02, 2003 6:04 AM
To: ruby-talk ML
Cc: ruby-talk@ruby-lang.org
Subject: Re: hash question…“D” == Dwayne Smurdon @ DNA Media Pro
smurdon@dnamediapro.com writes:map.keys.each |a| { person.a = rs.Fields(map[a]).Value }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is interpreted as an Hash, you must writemap.keys.each {|a| person.a = rs.Fields(map[a]).Value }
^^^^now it’s interpreted as a block
D:/Apps/Ruby/projects/OutlookContact.rb:29: odd number
list for HashThis error message is for this
pigeon% ruby -e ‘hash = { 1 }’
-e:1: odd number list for Hash
pigeon%pigeon% ruby -e ‘hash = { 1, 2 }’
pigeon%pigeon% ruby -e ‘hash = { 1, 2, 3 }’
-e:1: odd number list for Hash
pigeon%Guy Decoux