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" <victor.re... / gmail.com> 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