File: tracepoint.rb

# tracepoint.rb

Path: | lib/more/facets/tracepoint.rb
Last Update: | Tue Aug 10 17:25:06 -0600 2010

# TracePoint

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.

## Usage

      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

## Notes

You can‘t subclass Binding, so we delegate (which is better anyway).

## Authors

- Thomas Sawyer

## Copying

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.

### Required files

facets/binding

### Constants

CodePoint | = | Binding |  | # CodePoint This is the same as a Binding. Not really needed, but I like consistency :)

[Validate]