Class Debugger::ScriptInterface
In: cli/ruby-debug/interface.rb
Parent: Interface

A ScriptInterface is used when we are reading debugger commands from a command-file rather than an interactive user. Command files appear in a users initialization script (e.g. .rdebugrc) and appear when running the debugger command source (Debugger::SourceCommand).

Methods

Attributes

command_queue  [RW] 
histfile  [RW] 
history_length  [RW] 
history_save  [RW] 
restart_file  [RW] 

Public Class methods

[Source]

     # File cli/ruby-debug/interface.rb, line 217
217:     def initialize(file, out, verbose=false)
218:       super()
219:       @command_queue = []
220:       @file = file.respond_to?(:gets) ? file : open(file)
221:       @out = out
222:       @verbose = verbose
223:       @history_save = false
224:       @history_length = 256  # take gdb default
225:       @histfile = ''
226:     end

Public Instance methods

[Source]

     # File cli/ruby-debug/interface.rb, line 256
256:     def close
257:       @file.close
258:     end

confirm is called before performing a dangerous action. In running a debugger script, we don‘t want to prompt, so we‘ll pretend the user has unconditionally said "yes" and return String "y".

[Source]

     # File cli/ruby-debug/interface.rb, line 248
248:     def confirm(prompt)
249:       'y'
250:     end

[Source]

     # File cli/ruby-debug/interface.rb, line 252
252:     def print(*args)
253:       @out.printf(*args)
254:     end

[Source]

     # File cli/ruby-debug/interface.rb, line 228
228:     def read_command(prompt)
229:       while result = @file.gets
230:         puts "# #{result}" if @verbose
231:         next if result =~ /^\s*#/
232:         next if result.strip.empty?
233:         break
234:       end
235:       raise IOError unless result
236:       result.chomp!
237:     end

Do we have ReadLine support? When running an debugger command script, we are not interactive so we just return false.

[Source]

     # File cli/ruby-debug/interface.rb, line 241
241:     def readline_support?
242:       false
243:     end

[Validate]