From: Andrea Fazzi Date: 2008-11-04T22:50:20+09:00 Subject: Re: Conditional overriding of operators Daniel Vartanov ha scritto: > Hello! > > I am trying to replace .+ operator of Numeric class if and only if > argument (summand) is my own class. > > To be more specific: I am writing geometry module in Ruby and need to > implement vector-number multiplication so that both: > > 2 * vector > vector * 2 > > work well. > > Therefore I need to replace .+ method of Numeric without spoiling > arithmetical operations with other classes. > Hi Daniel, take a look at: http://www.splatbang.com/rubyquiz/quiz.rhtml?id=179_Modular_Arithmetic Hope that helps. Andrea