title: Ruby - Reduce array of numbers in ruby returns strange result
body: <p>I'm trying to write a method called <code>calculate</code> which determine to <code>add</code> or <code>subtract</code> numbers depending on a keyword argument passed to it.</p>
  
  <p>Here're the methods:</p>
  
  <pre><code>def add(*num)
    num.inject(:+)
  end
  
  def subtract(*num)
    num.reduce(:-)
  end
  
  def calculate(*num, **op)
    return add(num) if op[:add] || op.empty?
    return subtract(num) if op[:subtract]
  end
  
  puts calculate(1, 2, 3, add: true)
  puts calculate(1, 2, 3, subtract: true)
  </code></pre>
  
  <p>When I run this function, I get this result:</p>
  
  <pre><code>1
  2
  3
  
  1
  2
  3
  </code></pre>