(2012/11/26 5:47), SASADA Koichi wrote:
> * Is #klass method necessary since one can call `self.class`? But maybe `self.class` is much less efficient?

`klass' and `self.class' is different.

`klass' is several meaning:

* on call/return event: method defined class.

class C0
  def m
  end
end

class C1 < C0
end

TracePoint.trace(:call){|tp| p [tp.klass, tp.self.class]}
C1.new.m #=> [C0, C1]

* on class/end event: nil (I wonder this behavior!!)

* on line, raise event: class of current method.
...

The best solution seems prepare methods for each event.

such as:
  defined_class # it is for call, return event.
  current_class # it is for line, raise event.

...

I think only `defined_class' is enough.

Any comments?

-- 
// SASADA Koichi at atdot dot net