aboutsummaryrefslogtreecommitdiffstats
path: root/prelude.rb
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2019-11-07 18:22:08 +0900
committerKoichi Sasada <ko1@atdot.net>2019-11-08 09:09:29 +0900
commite2a45cb984ba75083a577b38ee9643800579a280 (patch)
tree9e8c56b3c7081b3ffdd8b65ca16c166ba186725e /prelude.rb
parent46acd0075d80c2f886498f089fde1e9d795d50c4 (diff)
downloadruby-e2a45cb984ba75083a577b38ee9643800579a280.tar.gz
use builtin for TracePoint.
Define TracePoint in trace_point.rb and use __builtin_ syntax.
Diffstat (limited to 'prelude.rb')
-rw-r--r--prelude.rb63
1 files changed, 0 insertions, 63 deletions
diff --git a/prelude.rb b/prelude.rb
index 4e23aba36e..7cc2d260b6 100644
--- a/prelude.rb
+++ b/prelude.rb
@@ -136,69 +136,6 @@ class IO
end
end
-class TracePoint
- # call-seq:
- # trace.enable(target: nil, target_line: nil, target_thread: nil) -> true or false
- # trace.enable(target: nil, target_line: nil, target_thread: nil) { block } -> obj
- #
- # Activates the trace.
- #
- # Returns +true+ if trace was enabled.
- # Returns +false+ if trace was disabled.
- #
- # trace.enabled? #=> false
- # trace.enable #=> false (previous state)
- # # trace is enabled
- # trace.enabled? #=> true
- # trace.enable #=> true (previous state)
- # # trace is still enabled
- #
- # If a block is given, the trace will only be enabled within the scope of the
- # block.
- #
- # trace.enabled?
- # #=> false
- #
- # trace.enable do
- # trace.enabled?
- # # only enabled for this block
- # end
- #
- # trace.enabled?
- # #=> false
- #
- # +target+, +target_line+ and +target_thread+ parameters are used to
- # limit tracing only to specified code objects. +target+ should be a
- # code object for which RubyVM::InstructionSequence.of will return
- # an instruction sequence.
- #
- # t = TracePoint.new(:line) { |tp| p tp }
- #
- # def m1
- # p 1
- # end
- #
- # def m2
- # p 2
- # end
- #
- # t.enable(target: method(:m1))
- #
- # m1
- # # prints #<TracePoint:line@test.rb:5 in `m1'>
- # m2
- # # prints nothing
- #
- # Note: You cannot access event hooks within the +enable+ block.
- #
- # trace.enable { p tp.lineno }
- # #=> RuntimeError: access from outside
- #
- def enable target: nil, target_line: nil, target_thread: nil, &blk
- self.__enable target, target_line, target_thread, &blk
- end
-end
-
class Binding
# :nodoc:
def irb