title: Why is my Ruby code to create this Class Method not working?
body: <p>Ruby n00b here trying to create a simple method to add to the Array class, but having considerable difficulty. I'm trying to code a method that not only returns the maximum value of an integer array, but the index where it occurs as well. Here is my code:</p>
  
  <pre><code>class Array
      def self.maxplus(matrix)
          i = 0
          maximum = 0
          while i &lt; matrix.length-1
              if matrix[i] &gt; maximum
                  maximum = matrix[i]
                  index = i
              end
              i += 1
          end
          puts index
          puts maximum
      end
  end
  </code></pre>
  
  <p>when I try to run <code>[0, 2, 4, 6, 8].maxplus</code>, I get the following compiler error:</p>
  
  <pre><code>undefined method 'maxplus' for [0, 2, 4, 6, 8]:Array (No Method Error)
  </code></pre>
  
  <p>I am at a loss and have been trying to figure the problem out on my for some time. Thanks so much for your help and education.</p>