title: Wrong number of arguments Ruby class method
body: <pre><code>class Array
  def pairs(target)
    pairs_array = []
    self.each_with_index do |number, idx|
      self.each_with_index do |number2, idx2|
        if (number + number2 == target)
          pairs &lt;&lt; [idx, idx2]
        end
      end
    end
    pairs
  end
  end
  
  arr = Array.new
  arr &lt;&lt; "1" &lt;&lt; "3" &lt;&lt; "1" &lt;&lt; "2" &lt;&lt; "3" &lt;&lt; "0"
  puts arr.pairs(3)
  </code></pre>
  
  <p>Error message:</p>
  
  <pre><code>Traceback (most recent call last):
      2: from main.rb:42:in `&lt;main&gt;'
      1: from main.rb:36:in `pairs'
  main.rb:27:in `pairs': wrong number of arguments (given 0, expected 1) (ArgumentError)
  </code></pre>
  
  <p>I am relatively new to this so I'm sorry if this is a stupid question but am I simply calling the method incorrectly? I am trying to call this and pass 3 as the target value.</p>
  
  <p>Thanks.</p>