Overriding Float#/ does not seem to have an effect:
class Float def /(other) "magic!" end end puts 10.0/2.0
But when another infix operator Float#* redefined, Float#/ unexpectedly accepts a new definition:
class Float def /(other) "magic!" end def *(other) "spooky" end end puts 10.0/2.0
I would like to hear if someone can explain the source of this behavior, and if someone else gets the same results.
- Ruby: ruby 2.0.0p353 (2013-11-22) [x64-mingw32]
To quickly confirm the error, run this script .
source share