This is a multi-part message in MIME format. ------ extPart_000_000C_01C2CA85.E16DB640 Content-Type: text/plain; charset so-8859-1" Content-Transfer-Encoding: 7bit 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: > > D> map.keys.each |a| { person.a s.Fields(map[a]).Value } > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > This is interpreted as an Hash, you must write > > map.keys.each {|a| person.a s.Fields(map[a]).Value } > ^^^^ > > now it's interpreted as a block > > D> D:/Apps/Ruby/projects/OutlookContact.rb:29: odd number > list for Hash > > This 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 > > ------ extPart_000_000C_01C2CA85.E16DB640 Content-Type: text/html; charset so-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows-1252"> <META NAME="Generator" CONTENT="MS Exchange Server version 6.0.6249.1"> <TITLE>dynamic method name...was RE: hash question...</TITLE> </HEAD> <BODY> <!-- Converted from text/plain format --> <P><FONT SIZE=2>First -- thanks Guy, that solved that problem and allowed me to find and move on to the next.</FONT> </P> <P><FONT SIZE=2>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:</FONT></P> <P><FONT SIZE=2>contact.phone = "703-277-7272" </FONT> </P> <P><FONT SIZE=2>But, let's say I have a variable, called meth. And meth == "phone". I want to use my variable meth like this:</FONT> </P> <P><FONT SIZE=2>contact.meth = "703-277-7272" # this should set phone</FONT> </P> <BR> <P><FONT SIZE=2>I tried using @meth, but I get a parse error. How would I go about doing this?</FONT> </P> <P><FONT SIZE=2>-Dwayne</FONT> </P> <BR> <P><FONT SIZE=2>> -----Original Message-----</FONT> <BR><FONT SIZE=2>> From: ts [mailto:decoux / moulon.inra.fr]</FONT> <BR><FONT SIZE=2>> Sent: Sunday, February 02, 2003 6:04 AM</FONT> <BR><FONT SIZE=2>> To: ruby-talk ML</FONT> <BR><FONT SIZE=2>> Cc: ruby-talk / ruby-lang.org</FONT> <BR><FONT SIZE=2>> Subject: Re: hash question...</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> >>>>> "D" == Dwayne Smurdon @ DNA Media Pro </FONT> <BR><FONT SIZE=2>> <smurdon / dnamediapro.com> writes:</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> D> map.keys.each |a| { person.a = rs.Fields(map[a]).Value }</FONT> <BR><FONT SIZE=2>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</FONT> <BR><FONT SIZE=2>> This is interpreted as an Hash, you must write</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> map.keys.each {|a| person.a = rs.Fields(map[a]).Value }</FONT> <BR><FONT SIZE=2>> ^^^^</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> now it's interpreted as a block</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> D> D:/Apps/Ruby/projects/OutlookContact.rb:29: odd number </FONT> <BR><FONT SIZE=2>> list for Hash</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> This error message is for this</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> pigeon% ruby -e 'hash = { 1 }'</FONT> <BR><FONT SIZE=2>> -e:1: odd number list for Hash</FONT> <BR><FONT SIZE=2>> pigeon%</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> pigeon% ruby -e 'hash = { 1, 2 }'</FONT> <BR><FONT SIZE=2>> pigeon% </FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> pigeon% ruby -e 'hash = { 1, 2, 3 }'</FONT> <BR><FONT SIZE=2>> -e:1: odd number list for Hash</FONT> <BR><FONT SIZE=2>> pigeon% </FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> Guy Decoux</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> </FONT> </P> </BODY> </HTML> ------ extPart_000_000C_01C2CA85.E16DB640--