Class: Debugger::SetCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug/commands/settings.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, inherited, #initialize, load_commands, #match, method_missing, options

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/ruby-debug/commands/settings.rb', line 30

def help(cmd)
  %{
     set <setting>, where <setting>:
     autolist - execute 'list' command on every breakpoint
     autoeval - evaluate every unrecognized command
     trace    - display stack trace when 'eval' raises exception
     To disable setting, use 'no' prefix, like 'noautolist'
	}
end

.help_commandObject



26
27
28
# File 'lib/ruby-debug/commands/settings.rb', line 26

def help_command
  "set"
end

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ruby-debug/commands/settings.rb', line 9

def execute
  case @match[1]
  when /^(no)?autolist$/
    ListCommand.always_run = $1.nil?
    print "Listing is #{$1.nil? ? 'on' : 'off'}.\n"
  when /^(no)?autoeval$/
    EvalCommand.unknown = $1.nil?
    print "Evaluation of unrecognized command is #{$1.nil? ? 'on' : 'off'}.\n"
  when /^(no)?trace$/
    @@display_stack_trace = $1.nil?
	print "Display stack trace is #{$1.nil? ? 'on' : 'off'}.\n"
  else
    print "Unknown setting.\n"
  end
end

#regexpObject



5
6
7
# File 'lib/ruby-debug/commands/settings.rb', line 5

def regexp
  /^set \s+ (.+) \s*/x
end