On 09/27/2010 10:04 PM, Trevor Hinesley wrote:
> Well, the problem is it isn't doing what I want it to.
> 
> It just prints -2, when I need it to print 6, since I'm wanting minus to 
> become plus basically.
> 
> When I do 2-4, I want it to do 2 minus negative four, which will give 
> six.

You're trying to treat minus as the unary version of the operator, but
in this usage it is the binary operator.  It also appears from your
example that you are trying to overload it for all numbers using a
non-number class named Overloading.  Since you're able to get it to
return -2 in your test, I assume that you have actually managed to
overload the operator for at least the Fixnum class.

Try the following:

class Fixnum
  def -(other)
    self + other
  end
end
b = 2 - 4
puts b