From: Brian Candler Date: 2009-11-16T19:46:06+09:00 Subject: Re: newbie ..need help with metaprogramming.. > var =":a1" > > t = Testvar.new > if t.respond_to?("#{var}") > p 'test 1- pass' > end Here you are testing if your object has a particular method. The method name is "a1". You can either pass the string "a1" or the symbol :a1 However you passed the string ":a1" consisting of three characters - colon, a, 1. > if t.instance_variable_set var , 'abc' > p 'test 2-pass' > end Here you are talking about an instance variable, not a method. The instance variable's name is "@a1". You can either pass the string "@a1" or the symbol :@a1 > if t.send var , 'def' > p 'test 3-pass' > end Here you're trying to call a setter method. The method's name is "a1=". Again, you can either pass the string "a1=" or the symbol :a1= -- Posted via http://www.ruby-forum.com/.