Class: Debugger::LocalInterface

Inherits:
Interface show all
Defined in:
lib/ruby-debug/interface.rb

Overview

:nodoc:

Constant Summary collapse

FILE_HISTORY =
".rdebug_hist"

Instance Attribute Summary collapse

Attributes inherited from Interface

#have_readline

Instance Method Summary collapse

Methods inherited from Interface

#afmt, #aprint, #errmsg

Constructor Details

#initializeLocalInterface

Returns a new instance of LocalInterface.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ruby-debug/interface.rb', line 43

def initialize()
  super
  @command_queue = []
  @have_readline = false
  @history_save = true
  # take gdb's default
  @history_length = ENV["HISTSIZE"] ? ENV["HISTSIZE"].to_i : 256  
  @histfile = File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", 
                        FILE_HISTORY)
  open(@histfile, 'r') do |file|
    file.each do |line|
      line.chomp!
      Readline::HISTORY << line
    end
  end if File.exist?(@histfile)
  @restart_file = nil
end

Instance Attribute Details

#command_queueObject

Returns the value of attribute command_queue.



34
35
36
# File 'lib/ruby-debug/interface.rb', line 34

def command_queue
  @command_queue
end

#histfileObject

Returns the value of attribute histfile.



35
36
37
# File 'lib/ruby-debug/interface.rb', line 35

def histfile
  @histfile
end

#history_lengthObject

Returns the value of attribute history_length.



37
38
39
# File 'lib/ruby-debug/interface.rb', line 37

def history_length
  @history_length
end

#history_saveObject

Returns the value of attribute history_save.



36
37
38
# File 'lib/ruby-debug/interface.rb', line 36

def history_save
  @history_save
end

#restart_fileObject

Returns the value of attribute restart_file.



38
39
40
# File 'lib/ruby-debug/interface.rb', line 38

def restart_file
  @restart_file
end

Instance Method Details

#closeObject



73
74
# File 'lib/ruby-debug/interface.rb', line 73

def close
end

#confirm(prompt) ⇒ Object



65
66
67
# File 'lib/ruby-debug/interface.rb', line 65

def confirm(prompt)
  readline(prompt, false)
end

#finalizeObject

Things to do before quitting



77
78
79
80
81
82
83
84
# File 'lib/ruby-debug/interface.rb', line 77

def finalize
  if Debugger.method_defined?("annotate") and Debugger.annotate.to_i > 2
    print "\032\032exited\n\n" 
  end
  if Debugger.respond_to?(:save_history)
    Debugger.save_history 
  end
end


69
70
71
# File 'lib/ruby-debug/interface.rb', line 69

def print(*args)
  STDOUT.printf(*args)
end

#read_command(prompt) ⇒ Object



61
62
63
# File 'lib/ruby-debug/interface.rb', line 61

def read_command(prompt)
  readline(prompt, true)
end

#readline_support?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/ruby-debug/interface.rb', line 86

def readline_support?
  @have_readline
end