title: How do you call class method from initialize method?
body: <p>I'm trying to call a method in a class during its initialize method. Is this not allowed? I originally had the method outside of the class to try and use it as a global method. The current method is trying to return the created matrix and then the initialize method saves the returned matrix into an instance variable. </p>
  
  <pre><code>class Member
    def setMatrix(a, i, l)
      puts "here"
      m = Matrix.zero(6)
      m[0,0] = a*l**2/i
      m[0,3] = -a*l**2/i
      m[1,1] = 12
      m[1,2] = 6*l
      m[1,4] = -12
      m[1,5] = 6*l
      m[2,1] = 6*l
      m[2,2] = 4*l**2
      m[2,4] = -6*l
      m[2,5] = 2*l**2
      m[3,0] = -a*l**2/i
      m[3,3] = a*l**2/i
      m[4,1] = -12
      m[4,2] = -6*l
      m[4,4] = 12
      m[4,5] = -6*l
      m[5,1] = 6*l
      m[5,2] = 2*l**2
      m[5,4] = -6*l
      m[5,5] = 4*l**2
      return m
      #@k = m
     end
  
     def initialize(a, i, l)
       @area = a
       @i = i
       @length = l
       @k = setMatrix(a, i, l)
      end
  end
  </code></pre>
  
  <p>Doing this returns this error     </p>
  
  <pre><code>`'setMatrix': private method '[]=' called for #&lt;Matrix:0x00000001186e00&gt; (NoMethodError)
  from truss_solver.rb:71:in 'initialize'
  from truss_solver.rb:86:in 'new'
  from truss_solver.rb:86:in 'block in &lt;main&gt;'
  from truss_solver.rb:85:in 'each'
  from truss_solver.rb:85:in '&lt;main&gt;'`
  </code></pre>
  
  <p>I would like it to make an instance variable of a matrix when the class is instantiated. I've also tried to have the setMatrix method save the matrix to @k directly instead of returning the matrix and that gave a similar error. How else can I do to achieve what I want?</p>