From: Victor Reyes Date: 2007-11-03T03:17:19+09:00 Subject: Re: Help invoking a method of a class ------=_Part_9486_20231865.1194027340855 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thank you all for your help. I agree, I really need to understand OOP. Thanks again Victor On 11/2/07, JeremyWoertink@gmail.com wrote: > > I think your going to get an undefined method error even after doing > t = Test.new > t.mag 10 > > you have Array.new(size) {l} <--what is l? > > On Nov 2, 10:07 am, "Victor Reyes" wrote: > > I started playing with classes and to that effect, I put this simple > > do-nothing class just to make sure I can invoke a method within a class. > > > > class Test > > def mag(size) > > maxLoop = size * size > > r1 = Array.new(size) {1} > > p r1 > > end # End method mag > > end # End class > > > > mag.Test 9 > > > > I am getting this error: > > > > C:\$user\ruby\Programs\DejaVou>ruby Test.rb > > Test.rb:9: undefined local variable or method `mag' for main:Object > > (NameError) > > > > Any ideas anyone? > > I am sure it is something trivial, but, trivial or not I can't get it. > > > > Thank you > > > > Victor > > > ------=_Part_9486_20231865.1194027340855--