Why are the +, -, *, and / operators acting like their +=, -=, *=, and /= counterparts?
I discovered this while I was trying to write a method that takes a height, like 69.in, and displays it as 5'9". Seemed like a straightforward problem:
def display_height(height)
"#{height.to_i/12}'#{height.to_i%12}\""
end
Except that the height variable keeps changing on me. So it looks like the only way around it right now is to set height = height.value.to_i, which will give me good ol' Fixnum back instead of an Alchemist::NumericConversion.
I'm not sure I understand why anyone would want this kind of behavior:
Why are the
+
,-
,*
, and/
operators acting like their+=
,-=
,*=
, and/=
counterparts?I discovered this while I was trying to write a method that takes a height, like
69.in
, and displays it as5'9"
. Seemed like a straightforward problem:Except that the height variable keeps changing on me. So it looks like the only way around it right now is to set
height = height.value.to_i
, which will give me good ol'Fixnum
back instead of anAlchemist::NumericConversion
.