| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2020-5-5 |
| 在线时间 | 39 小时 |
粉蜘蛛秀秀
- 梦石
- 0
- 星屑
- 76
- 在线时间
- 39 小时
- 注册时间
- 2007-6-4
- 回帖
- 346
 
|
发表于 2008-8-6 04:19:55
|
显示全部楼层
还是看不不懂...哎,想理解都难= =....
顺便问一下
Establishes proc as the handler for tracing, or disables tracing if the parameter is nil. proc takes up to six parameters: an event name, a filename, a line number, an object id, a binding, and the name of a class. proc is invoked whenever an event occurs. Events are: c-call (call a C-language routine), c-return (return from a C-language routine), call (call a Ruby method), class (start a class or module definition), end (finish a class or module definition), line (execute code on a new line), raise (raise an exception), and return (return from a Ruby method). Tracing is disabled within the context of proc
在详细解释一下把
这是set_trace_func 函数的说明
首先函数作为追踪处理的函数,如果参数设nil的话,则停止追踪
这个和trace_var的用法一样的
块接收6个参数 event,filename,line,object_id,binding,class
方法一旦被调用 就处理块(proc)
事件发生有几种情况,一种是call,一种是return
这两种情况已经说过了 就是调用的时候和返回的时候
还有 class 定义类或者模块的时候
raise 引发异常的时候
c-call和c-return 是调用一个C语言和返回一个C语言
最后一句的意思是 这个函数本身不能使用在块(proc)中
|
|