aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb/context.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-21 09:13:49 +0000
committeraycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-21 09:13:49 +0000
commit51cec00953ff8d7baa483d3846aa1dbdb89101aa (patch)
tree2900ea0ba7c09379990e9da2edda5d6ef8fa075c /lib/irb/context.rb
parent683834eb72cfa77f4eac1c705327b522302b1721 (diff)
downloadruby-51cec00953ff8d7baa483d3846aa1dbdb89101aa.tar.gz
Revert "IRB is improved with Reline and RDoc"
This reverts commit 7f273ac6d0f05208b5b228da95205e20c0e8286c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/context.rb')
-rw-r--r--lib/irb/context.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index f8a6009d17..e8e6a118e6 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -101,6 +101,7 @@ module IRB
if @echo.nil?
@echo = true
end
+ self.debug_level = IRB.conf[:DEBUG_LEVEL]
end
# The top-level workspace, see WorkSpace#main
@@ -210,6 +211,10 @@ module IRB
#
# A copy of the default <code>IRB.conf[:VERBOSE]</code>
attr_accessor :verbose
+ # The debug level of irb
+ #
+ # See #debug_level= for more information.
+ attr_reader :debug_level
# The limit of backtrace lines displayed as top +n+ and tail +n+.
#
@@ -356,6 +361,21 @@ module IRB
print "Do nothing."
end
+ # Sets the debug level of irb
+ #
+ # Can also be set using the +--irb_debug+ command line option.
+ #
+ # See IRB@Command+line+options for more command line options.
+ def debug_level=(value)
+ @debug_level = value
+ RubyLex.debug_level = value
+ end
+
+ # Whether or not debug mode is enabled, see #debug_level=.
+ def debug?
+ @debug_level > 0
+ end
+
def evaluate(line, line_no, exception: nil) # :nodoc:
@line_no = line_no
if exception