14
Jul
Posted by liubin as Ruby
| 1,232 Views
http://redhanded.hobix.com/inspect/methodsThatSelfDestruct.html
-
- class Trial
- def run_me
- def self.run_me; raise Exception, "NO MORE." end
- puts "Your trial period has ended."
- end
- end
-
- t = Trial.new
- t.run_me
- #=> Your trial period has ended.
- t.run_me
- #=> (trial):3:in `run_me': NO MORE. (Exception)
好像只是只能调用一次而已,对于一个对象。
Related posts for the current post: