What is the right way to overload operators in ruby? What do I need to do to redefine how + works? This function isn't being called when the + operator is used.
def +(a,b)
return a * b
end
p 2 + 2
What is the right way to overload operators in ruby? What do I need to do to redefine how + works? This function isn't being called when the + operator is used.
def +(a,b)
return a * b
end
p 2 + 2