summaryrefslogtreecommitdiff
path: root/lib/irb/ext/tracer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb/ext/tracer.rb')
-rw-r--r--lib/irb/ext/tracer.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/irb/ext/tracer.rb b/lib/irb/ext/tracer.rb
index 46a9d53a2e..8c9083dbad 100644
--- a/lib/irb/ext/tracer.rb
+++ b/lib/irb/ext/tracer.rb
@@ -23,9 +23,16 @@ module IRB
end
class Context
+ # Whether Tracer is used when evaluating statements in this context.
+ #
+ # See +lib/tracer.rb+ for more information.
attr_reader :use_tracer
alias use_tracer? use_tracer
+ # Sets whether or not to use the Tracer library when evaluating statements
+ # in this context.
+ #
+ # See +lib/tracer.rb+ for more information.
def use_tracer=(opt)
if opt
Tracer.set_get_line_procs(@irb_path) {
@@ -41,6 +48,10 @@ module IRB
class WorkSpace
alias __evaluate__ evaluate
+ # Evaluate the context of this workspace and use the Tracer library to
+ # output the exact lines of code are being executed in chronological order.
+ #
+ # See +lib/tracer.rb+ for more information.
def evaluate(context, statements, file = nil, line = nil)
if context.use_tracer? && file != nil && line != nil
Tracer.on