Path: | lib/more/facets/tracepoint.rb |
Last Update: | Thu Jun 24 13:18:25 +0000 2010 |
A TracePoint is a Binding with the addition event information. And it‘s a better way to use set_trace_func.
A TracePoint is a Binding with the addition of event information. Among other things, it functions very well as the join-point for Event-based AOP.
TracePoint.trace { |tp| puts "#{tp.self.class}\t#{tp.called}\t#{tp.event}\t#{tp.return?}\t#{tp.back == tp.bind}" } 1 + 1
produces
Class trace return true false Object line false false Fixnum + c-call false false Fixnum + c-return false false
You can‘t subclass Binding, so we delegate (which is better anyway).
Copyright (c) 2005 Thomas Sawyer
Ruby License
This module is free software. You may use, modify, and/or redistribute this software under the same terms as Ruby.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CodePoint | = | Binding | CodePointThis is the same as a Binding. Not really needed, but I like consistency :) |