diff options
Diffstat (limited to 'lib/irb/context.rb')
-rw-r--r-- | lib/irb/context.rb | 20 |
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 |