On Thu, Feb 10, 2011 at 10:22 AM, Mario Ruiz <tcblues / gmail.com> wrote: > I have to deal directly with the comparison and not with literals > because a third party is calling my log method and they are not going to > change the calls and they will be passing comparisons all time instead > of literals. I'm repeating myself, but.... a == b can be rewritten as a.==(b) It's just calling the #== method on 'a'. mi(4==3) is the same thing as mi(4.==(3)) When your #mi method is called, it ends up looking something like this: s(:call, nil, :mi, s(:arglist, s(:false))) i.e. it gets 'false' as it's sole argument. There is no good solution to what you want to do. A very bad solution might be something like this: irb(main):001:0> class Fixnum irb(main):002:1> def ==(val) irb(main):003:2> $last_comparison = [self, :==, val] irb(main):004:2> super irb(main):005:2> end irb(main):006:1> end => nil irb(main):007:0> 1 == 2 => false irb(main):008:0> $last_comparison => [1, :==, 2] i.e. override each of the methods on the objects that will be involved in the comparisons to record their calls. Then in your #mi method, you can use that record. It's bad because you should always be very reluctant to start changing the operation of core things like comparison methods on Fixnum, but it would achieve your goal. Kirk Haines Software Engineer Engine Yard